应该是: grant all on *.* to 'user@host' identified by 'password';
or grant all on *.* to 'user@IP' identified by 'password';
默认的情况下,mysql.user 里有一个root用户,它的主机是"localhost",如果你允许远程登录的话它就会新建一个root用户,它对应的主机为"%",见下面:mysql> select user,host from mysql.user;
+------+-----------+
| user | host      |
+------+-----------+
| root | %         |
| root | localhost |
+------+-----------+
2 rows in set (0.13 sec)所以你不能把root用户的主机全部改成"%".