我在 Debian Wheezy ( apt-get install mysql-server mysql-client
)上有一个非常标准的 MySQL 安装,我之前已经成功完成了很多次。
当我尝试通过 连接时localhost
,一切正常。但是连接通过127.0.0.1
给出错误消息:
$ mysql -h localhost -P 3306 -u xxx -p
-- works
$ mysql -h 127.0.0.1 -P 3306 -u xxx -p
ERROR 2013 (HY000): Lost connection to MySQL server at 'reading initial communication packet', system error: 0
Run Code Online (Sandbox Code Playgroud)
当我尝试从 Java 应用程序连接时,我得到了类似的错误,尽管我使用的localhost
是主机名:
com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure. The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any …
Run Code Online (Sandbox Code Playgroud) mysql ×1