docker连接的mysql报错 waiting for initial communication packet

docker连接的mysql报错 waiting for initial communication packet

解决办法:
1、在/etc/my.cnf
[mysqld]中加
skip-name-resolve

重启MySQL。

2、添加/etc/hosts文件
192.168.1.1 localhost
IP地址 主机名