Navicat远程连接Linux的MySQL服务Error10061的解决方案
写在前面
- Linux:Ubuntu Kylin16.04
- MySQL: 5.7.33
解决方法
- 原因:关于
Error10061
的最可能原因应该是MySQL中root用户不允许其他ip连接MySQL - 修改mysql库下的user表中的root用户允许任意ip连接
mysql> use mysql;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
Database changed
mysql> select user, host from user where user = 'root';
+------+-----------+
| user | host |
+------+-----------+
| root | localhost |
+------+-----------+
mysql> update mysql.user set host='%' where user='root';
mysql> select user, host from user where user = 'root';
+------+------+
| user | host |
+------+------+
| root | % |
+------+------+
1 row in set (0.00 sec)
- 刷新权限
mysql> flush privileges;
- 修改MySQL配置文件
[zhangsan @node01 /]$ sudo vim /etc/mysql/mysql.conf.d/mysqld.cnf
将bind-address= 127.0.0.1
这一行删除或者注释掉
- 再次连接不成功,重启MySQL服务
mysql> quit
[zhangsan @node01 /]$ sudo systemctl restart mysqld
结束!