Navicat连接mysql 报权限错误
ERROR 1130: Host 192.168.1.43 is not allowed to connect to this MySQL server
1.登录MySQL
mysql -u root -p
输入您的密码
2.选择 mysql 数据库
use mysql;
因为 mysql 数据库中存储了用户信息的 user 表。
3.在 mysql 数据库的 user 表中查看当前 root 用户的相关信息
1.select host, user, authentication_string, plugin from user;
2.show variables like '%skip_networking%';
执行完上面的命令后会显示一个表格
查看表格中 root 用户的 host,默认应该显示的 localhost,只支持本地访问,不允许远程访问。
4.授权 root 用户的所有权限并设置远程访问
CREATE USER 'root'@'%' IDENTIFIED BY '111111';
ALTER USER 'root'@'%' IDENTIFIED WITH mysql_native_password BY '111111';