一、方法:
登陆安装Mysql的机器的Mysql,
执行:
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY '密码' WITH GRANT OPTION;
刷新权限:
FLUSH PRIVILEGES
二、方法:
参考如下:http://www.cnblogs.com/hyzhou/archive/2011/12/06/2278236.html、https://www.cnblogs.com/songxingzhu/p/7028770.html
方法一、本地登入mysql,更改 "mysql" 数据库里的 "user" 表里的 "host" 项,将"localhost"改为"%" #mysql -u root -proot mysql>use mysql; mysql>update user set host = '%' where user = 'root'; mysql>select host, user from user; 方法二、直接授权(推荐) 从任何主机上使用root用户,密码:youpassword(你的root密码)连接到mysql服务器: # mysql -u root -proot mysql>GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'youpassword' WITH GRANT OPTION; 操作完后切记执行以下命令刷新权限 FLUSH PRIVILEGES