Mysql远程连接报错:SQL Error (1130): Host '192.168.1.3' is not allowed to connect to this MySQL server

虚拟机安装好msql后,window上使用Navicat Premium进行数据库连接,报错SQL Error (1130): Host ‘192.168.1.3’ is not allowed to connect to this MySQL server。

原因:
说明你所连接的用户账户没有远程连接的权限,只能在本机localhost登录
需要更改 mysql 数据库里的 user表里的 host字段 把localhost改称%

解决:
1.登录MySQL

mysql -uroot -proot

2.进入数据库

  use mysql;

3.查看是否有user表

show tables;

4.更改lost字段值

update user set host='%' where host = 'localhost';

5.刷新

 flush privileges;

6.查看

 select host,user from user;

Mysql远程连接报错:SQL Error (1130): Host '192.168.1.3' is not allowed to connect to this MySQL server_第1张图片
搞定!

你可能感兴趣的:(mysql)