在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;
=========================================================
注释掉在/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;
=========================================================