1、 mysql>update user set host = '%' where user = 'root';
mysql>select host, user from user;
2、mysql>GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'mypassword' WITH GRANT OPTION;
//赋予任何主机访问数据的权限
3、mysql>FLUSH PRIVILEGES ;
//修改生效
4、mysql>EXIT
//退出MySQL服务器
这样就可以在其它任何的主机上以root身份登录啦!
转载于:https://blog.51cto.com/jedy82/1554375