MySQL Server Has Gone Away - Solution

Solution for Error Code 2006 : Mysql Server Has Gone Away.

When you execute bulk insert in mysql server then you may be facing this error. To resolve this issue you need to increase packet size in Mysql Instance configuration.

Windows Version 

  • Go to mysql installed location (C:\Program Files \MySQL\MySQL Server Version Number)
  • Open mysql configuration file my.ini 
  • Navigate to this line [mysqld] 
  • Add "max_allowed_packet = 16M" without quotes
  • Save the file and restart the server 
Note : If you can't save the file for security reason then save it in desktop and then replace the desktop saved file with Mysql directory file.

Linux Version
  • Go to /usr/share/mysql and copy the file my-zzz.cnf (where zzz can be small,medium, large, huge)
  • Paste the file as my.cnf in /etc
Command  : $ cp /usr/share/mysql/my-zzz.cnf /etc/my.cnf
  • Open the my.cnf file and change the max_allowed_packet from 1M to 16M
  • Save the file and restart the server.

Now Execute the bulk insert without this issue...


Popular posts from this blog

Five More Indian Languages - Google Translate

Connect To JioFi Device Without Knowing The Passwords Using WPS