1130-host'192.168.2.137'is not allowed to connect to this mysql server

今天在连接数据库服务器是出现了1130-host'192.168.2.137'is not allowed to connect to this mysql server错误,

这个问题是因为在数据库服务器中的mysql数据库中的user的表中没有权限,记录下来

1130-host'192.168.2.137'is not allowed to connect to this mysql server_第1张图片

遇到这个问题首先到mysql所在的服务器上用连接进行处理

主要分为以下几步:

1、连接服务器: mysql -u root -p

  2、看当前所有数据库:show databases;

  3、进入mysql数据库:use mysql;

  4、查看mysql数据库中所有的表:show tables;

  5、查看user表中的数据:select Host, User,Password from user;

  6、修改user表中的Host:update user set Host='%' where User='root';

  7、最后刷新一下:flush privileges;

#连接服务器:mysql -uroot -proot

1130-host'192.168.2.137'is not allowed to connect to this mysql server_第2张图片

#产看当前所有数据库:show databases;

1130-host'192.168.2.137'is not allowed to connect to this mysql server_第3张图片

#进入mysql数据库:use mysql;

1130-host'192.168.2.137'is not allowed to connect to this mysql server_第4张图片

#查看mysql数据库中的所有的表:show tables;

1130-host'192.168.2.137'is not allowed to connect to this mysql server_第5张图片

#查看user表中的数据:select Host,User,Password from user;

#修改user表中的Host:update user set Host='%' where User='root';

#最后刷新一下:flush privileges;

#重新连接一下

1130-host'192.168.2.137'is not allowed to connect to this mysql server_第6张图片

你可能感兴趣的:(Mysql)