Skip to content

Solve MySQL server has gone away while importing large SQL file in 4 easy steps

The most common reason for MySQL server has gone away are closed connection and server timed out. Lets learn how to fix them in 4 easy steps
MySQL server has gone awayError

The MySQL server has gone away is a very common error that simply means the server (MySQL) went offline while it was working on something.

This is most commonly noted on executing a large SQL dump file or running a complex query, in the article we will case one.

Table of Contents

Download SQLYog

SQLYog is a client-side tool that I am using personally for a long time. This helps me to run a query on my desktop directly in place of using famous PHPMyAdmin.

Locate my.cnf

The MySQL default configuration is not very great for production use. Some of the default values in my.cnf should be changed when you need it for business-critical applications
Location of my.cnf :

sudo nano /etc/mysql/my.cnf
or
/etc/my.cnf
or
/etc/mysql/my.cnf
or
SYSCONFDIR/my.cnf
or
$MYSQL_HOME/my.cnf
or
defaults-extra-file (the file specified with –defaults-extra-file=path, if any)
or
~/.my.cnf

Edit my.cnf

find / add
wait_timeout = 600
max_allowed_packet = 64M

Restart MySQL

Now simply restart MySQL using:

sudo /etc/init.d/mysql restart
Facebook
Twitter
LinkedIn
Digg
Picture of Shashi kant Pandidhar

Shashi kant Pandidhar

I’ve been helping businesses to be online for over 15 years. Today my team and I, focus on helping real businesses to overcome real-life challenges and analyse data in a way that can help businesses grow in the right direction of this digital age.

Leave a Comment

About Me

Picture of Shashi kant Pandidhar

Shashi kant Pandidhar

I’ve been helping businesses to be online for over 15 years. Today my team and I, focus on helping real businesses to overcome real-life challenges and analyse data in a way that can help businesses grow in the right direction of this digital age.

Related Posts

Follow Us

Ads

Subscribe: Trusted By 1M+ Readers

Get the weekly Tech Update straight to your inbox.

//
Our customer sales team is here to answer your questions. Ask us anything!
👋 Hi, how can I help?