While using a script to overwrite my local database with the Prod database, I ran into this error:

ERROR 2006 (HY000) at line 27652: MySQL server has gone away

Some Google-fu indicated that it was a timeout problem. I found information on fixing it online, but none of it applied to my setup -- I'm running MAMP Pro 2. To work things out on my local installation, I took the following steps:

  • Opened up the MAMP Pro application and stopped the servers.
  • Opened File > Edit Template > MySQL my.cnf.
  • Changed max_allowed_packet = 1M to max_allowed_packet = 64M under [mysqld].
  • Added wait_timeout = 6000 under [mysqld].
  • Changed max_allowed_packet = 16M to max_allowed_packet = 64M under [mysqldump].
  • Saved the template.
  • Restarted the MAMP Pro servers.

I haven't tested different variations of these updates, so I'm not sure if both wait_timeout and the max_allowed_packet updates were necessary. But after the updates above, the error was gone.

相关文章:

  • 2021-06-08
  • 2021-07-24
  • 2022-02-16
  • 2022-12-23
  • 2021-07-21
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-05-25
  • 2022-02-15
  • 2021-12-16
  • 2022-12-23
  • 2021-12-25
相关资源
相似解决方案