以Linux为例:

1
2
3
4
5
6
7
$ mysql -u root -p
Enter password:{password}

mysql>use mysql;
mysql>update user set host='%' where user='root';
mysql>flush privileges;
mysql>quit