笔者当前的版本
- 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 |
+-----------+------------------+