zoukankan      html  css  js  c++  java
  • 远程mysql出现ERROR 1130 (HY000): Host '172.17.42.1' is not allowed to connect to this MySQL server

    ERROR 1130: Host ***.***.***.*** is not allowed to connect to this MySQL server
    说明所连接的用户帐号没有远程连接的权限,只能在本机(localhost)登录。 需更改 mysql 数据库里的 user表里的 host项
    把localhost改称%
    具体步骤:登陆到MySQL 首先 use mysql;
    按照别人提供的方式update的时候,出现错误。

    MySQL> update user set host='%' where user = 'root';

    ERROR 1062 (23000): Duplicate entry '%-root' for key 'PRIMARY'
    然后查看了下数据库的host信息如下:

    MySQL> select host from user where user = 'root';
    +-----------------------+

    |host|

    +-----------------------+

    |% |

    | 127.0.0.1 |

    | localhost.localdomain |

    +-----------------------+
    3 rows in set (0.00 sec) host已经有了%这个值,所以直接运行命令:

    代码如下:
    MySQL>flush privileges;

    再用 mysql -uroot -h***.***.***.***连接...成功!!

    本文参考http://www.jb51.net/article/31902.htm

  • 相关阅读:
    hdu2328 Corporate Identity
    hdu1238 Substrings
    hdu4300 Clairewd’s message
    hdu3336 Count the string
    hdu2597 Simpsons’ Hidden Talents
    poj3080 Blue Jeans
    poj2752 Seek the Name, Seek the Fame
    poj2406 Power Strings
    hust1010 The Minimum Length
    hdu1358 Period
  • 原文地址:https://www.cnblogs.com/cuizhipeng/p/4386856.html
Copyright © 2011-2022 走看看