为什么我无法连接到MySQL?
mysql -u root -ptest101 -h xxx.xxx.xxx.xxx
ERROR 1130 (HY000): Host 'xxx.xxx.xxx.xxx' is not allowed to connect to this MySQL server
我在my.cnf文件中有以下内容
# Instead of skip-networking the default is now to listen only on
# localhost which is more compatible and is not less secure.
bind-address = 0.0.0.0
我也运行了以下代码...
'UPDATE mysql.user SET Password = PASSWORD('test101') WHERE User = 'root';
FLUSH PRIVILEGES;
我可以使用mysql -u root -ptest101在主机上访问,但无法使用mysql -u root -ptest101 -h xxx.xxx.xxx.xxx访问。
哇...为什么会发生这种情况?我是Ubuntu 12.04。
mysql> SELECT host FROM mysql.user WHERE User = 'root';
+---------------------------------------------+
| host |
+---------------------------------------------+
| % |
| 127.0.0.1 |
| ::1 | |
| localhost |
+---------------------------------------------+
5 rows in set (0.00 sec)
user@host
对,其中任何一方都可以是通配符。您可能正在使用正确的用户名,但您是否也授予了正确的主机权限呢? - Marc B