MySQL “#2006 - MySQL server has gone away” in phpMyAdmin

Getting the dreaded error #2006 - MySQL server has gone away while importing files into phpmyadmin?This guide will help you step by step to solve the issue.

  1. Open my.ini or my.cnf (mysql config file)
    1. Make sure your max_allowed_packet = 64M is set to a larger value (default is 1MB).
    2. Save and restart MySQL
  2. Open your php.ini file
    1. Make sure the max file names are larger than the filesize of the file you are trying to upload to phpMyAdmin:post_max_size = 64Mupload_max_filesize = 64M
    2. Save the php.ini changes and restart Apache
  3. Open your phpMyAdmin Configuration file - PMA_path/libraries/config.default.php
    1. Check $cfg['ExecTimeLimit']  - the value of this variable should be greater than its default value of 300 seconds.
Topics: