1、修改localhost
更改 "mysql" 数据库里的 "user" 表里的 "host" 项,从"localhost"改成"%"
mysql>use mysql;
mysql>update user set host = '%' where user = 'root';
mysql>select host, user from user;
更改 "mysql" 数据库里的 "user" 表里的 "host" 项,从"localhost"改成"%"
mysql>use mysql;
mysql>update user set host = '%' where user = 'root';
mysql>select host, user from user;
mysql>FLUSH PRIVILEGES;
2
#sudo gedit /etc/mysql/my.cnf
#skip-external-locking
#bind-address = 127.0.0.1
skip-name-resolve
3,
修改/etc/my.cnf或my.ini
[mysqld]下添加
skip-name-resolve
skip-grant-tables
4,
查看/etc/mysql/my.cnf中,skip-networking 是否已被注掉
需要注掉
报错:ERROR 2003 (HY000): Can't connect to MySQL server on '192.168.51.112' (111)
sudo gedit /etc/mysql/my.cnf
#skip-external-locking
#bind-address = 127.0.0.1
skip-name-resolve
5
设置好以后需要重启:sudo service mysql restart