笔者当前的版本

  • mysql Ver 14.14 Distrib 5.7.30
  • ubuntu 16.04.6

解决方案

查看端口是否有误,默认是3306

1.查看远程连接权限是否打开 修改 root 用户 host = % 并且重启mysql

update user set host=’%’ where user ==’root’;

sudo service mysql restart

+-----------+------------------+
| host      | user             |
+-----------+------------------+
| %         | root             |
| localhost | debian-sys-maint |
| localhost | mysql.session    |
| localhost | mysql.sys        |
+-----------+------------------+

2.修改mysqld.cnf ,直接注释掉bind_address

#bind-address = 127.0.0.1

sudo service mysql restart

文章来源于互联网:Ubuntu 远程连接 mysql 出现 ERROR 2003 (HY000): Can’t connect to MySQL server on ‘xxxx….’ (111)

发表评论