1. 改表法. 在数据库所在机器登入 MySQL 后, 更改 "MySQL" 数据库里的 "user" 表里的 "host" 项, 把 "localhost" 改称 "%"
- MySQL -u root -p
- MySQL>use MySQL;
- MySQL>select 'host' from user where user='root';
- MySQL>update user set host = '%' where user ='root';
- MySQL>flush privileges;
- MySQL>select host,user from user where user='root';
重起 MySQL 服务即可完成.
授权法. 在数据库所在机器登入 MySQL 后, 直接进行授权
grant all privileges on . to 'root'@'%' identified by 'password' with grant option;
来源: http://www.bubuko.com/infodetail-2776048.html