1、mysql -u root -p
输入密码
2、use mysql
3、select host,user,authentication_string from user;
4、update user set host=‘%‘ where user = ‘root‘;
5、grant all privileges on *.* to root@‘%‘ identified by "password";
6、flush privileges;
原文:https://www.cnblogs.com/liuyanerfly/p/9436454.html