Navicat连接远端mysql报错Lost connection to MySQL server at ‘reading initial communication packet‘, system

故障现象:
(一)ubuntu18.04中安装的mysql5.7,在ubuntu本地可以正常连接mysql服务器

mysql -uroot -p

但在windows远端使用navicat连接的时候提示:
Lost connection to MySQL server at ‘reading initial communication packet’, system error:0
解决方法:
修改配置文件中的bind_address,5.7的配置文件为/etc/mysql/mysql.conf.d/mysqld.cnf

sudo vi /etc/mysql/mysql.conf.d/mysqld.cnf

修改为下面的:

bind_address = 0.0.0.0

(二)在修改完bind_address,远端的navicat还是无法连接mysql5.7,连接时错误提示:
Host ‘192.168.x.xx’ is not allowed to connect to this MySQL server
解决方法:
在ubuntu中登录mysql

mysql -uroot -p
use mysql
update user set host = '%' where user = 'root';
flush privileges

再使用远端的navicat连接应该可以了。

你可能感兴趣的:(linux,mysql,navicat,mysql,navicat)