MySQL server has gone away


问题描述

mysql报错 2006, MySQL server has gone away

解决方法

  1. 修改 /etc/mysql/mysql.conf.d/mysqld.cnf 配置 ^2

    • 设置wait_timeout

      例如: 设置wait_timeout=180

    • 设置max_allowed_packet

      [mysqld]
      max_allowed_packet=16M
    • 使用 mysqli_ping ^1

  1. 重启 mysql
    $ sudo /etc/init.d/mysql restart

参考文档


Author: Itaken
Reprint policy: All articles in this blog are used except for special statements CC BY 4.0 reprint polocy. If reproduced, please indicate source Itaken !
  TOC目录