打开mysql命令界面
修改配置
mysql -u root -p
mysql>use mysql;
mysql>update user set host = '%' where user = 'root' and host='localhost';
mysql>select host, user from user;
mysql>FLUSH PRIVILEGES; 使修改生效。
重启mysql服务
service mysql stop
service mysql start
打开mysql命令界面
修改配置
mysql -u root -p
mysql>use mysql;
mysql>update user set host = '%' where user = 'root' and host='localhost';
mysql>select host, user from user;
mysql>FLUSH PRIVILEGES; 使修改生效。
重启mysql服务
service mysql stop
service mysql start