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;