Mysql远程登录报错:Host '192.168.1.3' is not allowed to connect to this MySQL server

Posted hannibal-2018

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Mysql远程登录报错:Host '192.168.1.3' is not allowed to connect to this MySQL server相关的知识,希望对你有一定的参考价值。

你要访问的mysql服务器设置了访问权限:如果那个服务器是你自己搭建的解决办法如下,但如果不是你的请管理员帮你添加权限

解决办法1:

# 1. 改表
#     登录数据库:mysql -u root -p

mysql>use mysql;

mysql>update user set host = % where user = root;

mysql>FLUSH PRIVILEGES;
2. 授权法。

(1)例如,你想myuser使用mypassword从任何主机连接到mysql服务器的话。

第一步:root用户登录;mysql>mysql -u root -p rootpassword;

第二步:赋予权限;mysql>GRANT ALL PRIVILEGES ON *.* TO root@% IDENTIFIED BY mypassword WITH GRANT OPTION;

第三步:mysql>FLUSH   PRIVILEGES;

(2)如果你想允许用户myuser从ip为192.168.1.3的主机连接到mysql服务器,并使用mypassword作为密码

mysql>GRANT ALL PRIVILEGES ON *.* TO root@192.168.1.3 IDENTIFIED BY mypassword WITH GRANT OPTION;

mysql>FLUSH   PRIVILEGES;

(3)如果你想允许用户myuser从ip为192.168.1.3的主机连接到mysql服务器的dk数据库,并使用mypassword作为密码

mysql>GRANT ALL PRIVILEGES ON dk.* TO root@192.168.1.3 IDENTIFIED BY mypassword WITH GRANT OPTION;

mysql>FLUSH   PRIVILEGES;

以上是关于Mysql远程登录报错:Host '192.168.1.3' is not allowed to connect to this MySQL server的主要内容,如果未能解决你的问题,请参考以下文章

远程mysql报错GHost ‘xxx‘ is not allowed to connect to this MySQL serverConnection closed by foreign host

Host '192.168.1.21' is not allowed to connect to this MySQL server

Mysql host '192.168.1.1' is not allowed to connect to this mysql server

MySQL——远程连接非本地MySQL数据库服务器,报错ERROR 1130: Host 192.168.3.100 is not allowed to connect to this MySQL s

Host is not allowed to connect to this MySQL server解决方法

远程登陆mysql报错:ERROR 1130 (HY000): Host '10.0.0.8' is not allowed to connect to this MySQL serv