美文网首页
Host '172.16.252.xxx' is

Host '172.16.252.xxx' is

作者: syncwt | 来源:发表于2016-08-30 22:04 被阅读20次

    报错

    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! 
    

    相关文章

      网友评论

          本文标题:Host '172.16.252.xxx' is

          本文链接:https://www.haomeiwen.com/subject/jxlqettx.html