现在的位置: 首页 > 综合 > 正文

报错:1130-host … is not allowed to connect to this MySql server

2019年08月23日 ⁄ 综合 ⁄ 共 676字 ⁄ 字号 评论关闭

Linux安装完mysql之后,用Navicat工具连接报错:

1130-host '' is not allowed to connect to this MySql server

解决方法:

可能是你的帐号不允许从远程登陆,只能在localhost。这个时候只要在localhost的那台电脑,登入mysql后,更改 "mysql" 数据库里的 "user" 表里的 "host" 项,从"localhost"改称"%"

[root@localhost ~]# mysql -u root -p

mysql>use mysql;

mysql>update user set host = '%' where user = 'root' and host = 'localhost';

Query OK, 0 rows affected (0.00 sec)

Rows matched: 0  Changed: 0  Warnings: 0

mysql>select host, user from user;

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

| host                  | user |

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

| %                     |      |

| %                     | root |

| 127.0.0.1             | root |

| ::1                   | root |

| localhost.localdomain |      |

| localhost.localdomain | root |

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

6 rows in set (0.00 sec)



OK,解决。

其他方法待验证。

抱歉!评论已关闭.