持续创作,加速成长!这是我参与「掘金日新计划 · 10 月更文挑战」的第31天,点击查看活动详情
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
❝
结束!
❞
本文使用 markdown.com.cn 排版