ERROR 1130 (HY000): Host '192.168.20.165' is not allowed to connect to this MySQL server

问题

远程连接mysql时遇到如下问题:

ERROR 1130 (HY000): Host '192.168.20.165' is not allowed to connect to this MySQL server

解决

远程登录有权限限制,需要对用户赋权。

GRANT ALL PRIVILEGES ON *.* TO 'myuser'@'%' IDENTIFIED BY 'mypassword' WITH GRANT OPTION;

表示授权某个用户在哪些主机上可以对哪些数据库和表进行哪些操作。

  • ON *.* db.table: 数据库和数据表
  • TO user: 要授权的用户
  • @ host: %’表示任何主机

参考

http://blog.csdn.net/leroy008/article/details/16116847

原文地址:https://www.cnblogs.com/lanyangsh/p/8143757.html