报错
Host '172.16.252.129' is not allowed to connect to this MySQL server
意思是无法访问,即没有host权限。
解决方案
将root权限开放为所有主机。
# mysql -u root -p
>mysql SELECT DISTINCT CONCAT('User: ''',user,'''@''',host,''';') AS query FROM mysql.user;
+---------------------------------------+
| query |
+---------------------------------------+
| User: 'root'@'127.0.0.1'; |
| User: 'root'@'::1'; |
| User: 'root'@'localhost'; |
| User: 'root'@'localhost.localdomain'; |
+---------------------------------------+
4 rows in set (0.01 sec)
mysql> update mysql.user set host = '%' where host = 'localhost';
Query OK, 1 row affected (0.00 sec)
Rows matched: 1 Changed: 1 Warnings: 0
mysql> SELECT DISTINCT CONCAT('User: ''',user,'''@''',host,''';') AS query FROM mysql.user;
+---------------------------------------+
| query |
+---------------------------------------+
| User: 'root'@'%'; |
| User: 'root'@'127.0.0.1'; |
| User: 'root'@'::1'; |
| User: 'root'@'localhost.localdomain'; |
+---------------------------------------+
4 rows in set (0.00 sec)
# service mysql restart
Shutting down MySQL.. SUCCESS!
Starting MySQL. SUCCESS!
网友评论