其他分享
首页 > 其他分享> > 错误1130- Host xxx is not allowed to connect to this MariaDb server

错误1130- Host xxx is not allowed to connect to this MariaDb server

作者:互联网

navicat 连接mysql报错:

1130- Host xxx is not allowed to connect to this MariaDb server

解决方案:

1.确保服务器开启了3306端口。

2.改表法:

mysql -u root -p
mysql>use mysql;
mysql>update user set host = '%' where user = 'root'  and host='localhost';
mysql>select host, user from user;

MariaDB [mysql]> flush privileges;

3.授权法:

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

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

FLUSH   PRIVILEGES;

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

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

FLUSH   PRIVILEGES;

如果你想允许用户root从ip为192.168.1.6的主机连接到mysql服务器的test数据库,并使用mypassword作为密码

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

FLUSH   PRIVILEGES;

 

 

 

 

在安装mysql的机器上运行:
mysql -u root -password
mysql>usemysql;
mysql>update user set host = '%' where user ='root';
mysql>select host, user from user;
mysql>flush  privileges;
---------------------

原文:https://blog.csdn.net/davidyezhiwei/article/details/77295402

 

 

 

这个错误,其实就是我们的MySQL不允许远程登录,所以远程登录失败了,解决方法如下:

  1. 在装有MySQL的机器上登录MySQL mysql -u root -p密码
  2. 执行use mysql;
  3. 执行update user set host = '%' where user = 'root';这一句执行完可能会报错,不用管它。
  4. 执行FLUSH PRIVILEGES;

    经过上面4步,就可以解决这个问题了。 
    注: 第四步是刷新MySQL的权限相关表,一定不要忘了,我第一次的时候没有执行第四步,结果一直不成功,最后才找到这个原因

原文:http://blog.csdn.net/bingjianit/article/details/54384299

标签:1130,GRANT,mypassword,PRIVILEGES,xxx,server,user,mysql,root
来源: https://www.cnblogs.com/anyiz/p/10658109.html