Lost connection to MySQL server at 'reading initial communication packet', system error: 104

报错

SQLSTATE[HY000] [2013] Lost connection to MySQL server at 'reading initial communication packet', system error: 104 "Connection reset by peer" 


PDOException: SQLSTATE[HY000] [2003] Can't connect to MySQL server on '127.0.0.1' (111 "Connection refused") ```
很奇怪,自从在阿里云的服务器挂载了一个新的云磁盘,然后把mysql 存放目录完全迁移,就总是报这个错误。

尝试修改

MariaDB [(none)]> select Host,User from mysql.user where user='root';
+-----------+------+
| Host      | User |
+-----------+------+
| 127.0.0.1 | root |
| ::1       | root |
| localhost | root |
+-----------+------+
3 rows in set (0.00 sec)

按照网上查询到的资料,需要更改链接地址 127.0.0.1 改为localhost 。 只能看接下来是否还会有这样的报错了。

你可能感兴趣的:(MYSQL)