Troubleshooting MySQL Server Has Gone Away WordPress error


  • Applies to: Grid
    • Difficulty: Easy
    • Time Needed: 10
    • Tools Required: Account Center access
  • Applies to: DV
    • Difficulty: Easy
    • Time Needed: 10
    • Tools Required: Account Center access
  • Applies to: WordPress Hosting
    • Difficulty: Easy
    • Time Needed: 10
    • Tools Required: Account Center access

Overview

Database errors are a common issue that occur with WordPress sites. A frequent database error you may see is MySQL Server Has Gone Away. Despite the wording, in most cases your MySQL Server hasn't actually "gone away." There can be a variety of reasons for this error to occur, but generally the cause can be broken down to one of the following:

  • The database has timed out.
  • A packet is too large or has been dropped.
  • A database table has become broken/corrupted.

The following guide will provide some troubleshooting steps that can be taken to help address these issues.

STATEMENT OF SUPPORT:
Please keep in mind that troubleshooting the configuration/functionality of third-party applications is not covered by our statement of support. These resources were provided as a courtesy to assist you to the extent of our abilities. For more information on our statement of support, feel free to click here.

Instructions

Increase max_execution_time

This can help if your database is having trouble retrieving data before the timeout window.

  1. Navigate to your php.ini file. php.ini file.
  2. Input the following line of code:
    max_execution_time = 300
  3. Save your changes made to the php.ini file.
  4. Check your website to see if this has resolve the issue.

Repair the database

This can help if a database table has become corrupted. phpMyAdmin has a built-in feature that can allow you to repair tables.

  1. Log into your database using phpMyAdmin. phpMyAdmin. phpMyAdmin.

    php-1.png

  2. Run the repair table repair table repair table operation on your database.

    php-2.png

  3. Check your website to see if this has resolve the issue.

Restore the database from a backup

If the above solutions do not fix your issue, you can attempt to restore the site from a backup. When selecting a backup, it's best to pick backups from a time that you knew the site to be working. Then out of the available backups, you will want to choose the most recent one, to minimize any loss of data.

If you  have a personal backup of the database you can simply import this backup onto your server.

You can check if you have a Media Temple or control panel backup option to restore your database from.

If all else fails, you can submit an Emergency Restore Request for our adminisrators to see if there is a backup available from your requested time period. Do keep in mind that Emergency Restore Requests are time sensitive, so its best to submit these as early as possible.

If you have a personal backup, you can simply import this backup onto your server.

Grid Personal, Pro, and Elite users also have 30-day database backups available through the File Manager. Do keep in mind you will still need to import the backup after you've recovered the database file.

If you are not on a Grid Personal, Pro, and Elite plan, you have the option to submit a Emergency Restore Request for our adminisrators to see if there is a backup availalbe from your requested time period. Do keep in mind that Emergency Restore Requests are time sensitive, so its best to submit these as early as possible.

If you have a personal backup of the database you can simply import this backup onto your server.

Managed WordPress users also have 30-day site backups built-in the service to restore from.