世态炎凉一依然吧 关注:21贴子:715
  • 0回复贴,共1

关于mysql安装后远程连接无法连接的问题~

只看楼主收藏回复

在ubuntu14.04上安装好mysql5.7之后,本地可以连接mysql,远程就不行(Host 'xxx' is not allowed to connect to this MySQL server)。
注释掉在/etc/mysql/mysql.conf.d/mysqld.cnf里面的bind-address = 127.0.0.1
=========================================================
# By default we only accept connections from localhost
#bind-address = 127.0.0.1
=========================================================
如果还有问题,如Access denied for user ‘root’@’ip地址’ (using password: YES)
=========================================================
mysql -uroot -p
=========================================================
输入root用户密码,进入mysql服务器命令行
=========================================================
use mysql;
Grant all on *.* to 'root'@'%' identified by 'root用户的密码' with grant option;
flush privileges;
=========================================================
然后用以下命令查看哪些用户和host可以访问,%代表任意ip地址
=========================================================
select user,host from user;
=========================================================


IP属地:黑龙江1楼2018-06-01 15:49回复