I'm running a server at my office to process some files and report the results to a remote MySQL server.
The files processing takes some time and the process dies halfway through with the following error:
2006, MySQL server has gone away
I've heard about the MySQL setting, wait_timeout, but do I need to change that on the server at my office or the remote MySQL server?
I found the solution to "#2006 - MySQL server has gone away" this error. Solution is just you have to check two files
Path of these files in windows is
In these two files the value of this:
In my case it was:
change it to:
Make sure in both:
And last set:
Then restart Wampserver.
To change phpmyadmin user name and password
You can directly change the user name and password of phpmyadmin through config.inc.php file
These two lines
Here you can give new user name and password. After changes save the file and restart WAMP server.
I've encountered this a number of times and I've normally found the answer to be a very low default setting of
max_allowed_packet
.Raising it in
/etc/my.cnf
(under[mysqld]
) to 8 or 16M usually fixes it. (The default in MySql 5.7 is4194304
, which is 4MB.)Note: This can be set on your server as it's running.
Use
set global max_allowed_packet=104857600
. This sets it to 100MB.uncomment the ligne below in your
my.ini/my.cnf
, this will split your large file into smaller portionTO
I got Error 2006 message in different MySQL clients software on my Ubuntu desktop. It turned out that my JDBC driver version was too old.
It's always a good idea to check the logs of the Mysql server, for the reason why it went away.
It will tell you.
I was getting this same error on my DigitalOcean Ubuntu server.
I tried changing the max_allowed_packet and the wait_timeout settings but neither of them fixed it.
It turns out that my server was out of RAM. I added a 1GB swap file and that fixed my problem.
Check your memory with
free -h
to see if that's what's causing it.