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

相关文章:

  • 2021-06-14
  • 2022-12-23
  • 2022-12-23
  • 2021-06-11
  • 2021-09-07
  • 2022-12-23
  • 2022-12-23
  • 2021-10-10
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-05-10
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案