Mysql Server Has Gone Away Xampp

Posted on by admin

Your “MySQL has run away”? Sorry, but this is something new to me, because I have never seen my MySQL running away from anywhere:P However, sometimes MySQL. Mysql server has gone away; start mongodb in terminal; mysql default port number; mysql installer no packages found; install mysql server 8.0 deepin 20; django sqlite database; set mysql password xampp; change permission to database mysql; safe mode off mysql; Host '' is not allowed to connect to this MySQL server.

Panduan cara mengatasi MySQL server has gone away saat import database melalui command-line.Kalau import database via phpMyAdmin indikasinya saat proses import/upload database belum sampai 100% tiba-tiba phpMyAdmin berhenti loading dan tampilannya berantakan. Sktzoootech March 30, 2018 Your mysql server has probably timed out and might be fixed by checking if the wait timeout mysql variable in your mysql configuration file (my.cnf) is large enough. It could also be caused by an incorrect or a too large packet. You can fix this by increasing the packet size limit max allowedpacket in my.cnf file.

Feedback sent successfully Thank you for your valuable feedback. We will use it to make even better.

The MySQL server has gone away (error 2006) has two main causes and solutions:

  • Server timed out and closed the connection. To fix, check that wait_timeout mysql variable in your my.cnf configuration file is large enough, eg wait_timeout = 28800
  • You may also need to increase the innodb_log_file_size mysql variable in your my.cnf configuration to for example innodb_log_file_size = 128MB or higher.
  • Server dropped an incorrect or too large packet. If mysqld gets a packet that is too large or incorrect, it assumes that something has gone wrong with the client and closes the connection. To fix, you can increase the maximal packet size limit max_allowed_packet in my.cnf file, eg. set max_allowed_packet = 128M, then restart your MySQL server: sudo /etc/init.d/mysql restart

Once you’ve made these changes, and restarted your MySQL or MariaDB server, the issue should be fixed and no more error triggered. If not, try increase the 128M values to 256M for example. In websites with a lot of traffic and data, you might even need to increase the value to 1024M.

If the above changes do not resolve the issue and if you are using MYSQLI adapter in Matomo, try switching to adapter = PDOMYSQL in your config/config.ini.php file.

You may be interested to learn more about Matomo Analytics to measure your websites and apps and keep control of your analytics data.

Thanks for contacting us! We will get in touch with you shortly.

Feedback on this page

It may be easier to check if the connection and re-establish it if needed.

See PHP:mysqli_ping for info on that.

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.


Note: This can be set on your server as it's running.

Use set global max_allowed_packet=104857600. This sets it to 100MB.

I had the same problem but changeing max_allowed_packet in the my.ini/my.cnf file under [mysqld] made the trick.

add a line


now restart the MySQL service once you are done.

In MAMP (non-pro version) I added


Credits and more details here

I used following command in MySQL command-line to restore a MySQL database which size more than 7GB, and it works.


Message: MySQL server has gone away


Generally you can retry connecting and then doing the query again to solve this problem - try like 3-4 times before completely giving up.

I'll assuming you are using PDO. If so then you would catch the PDO Exception, increment a counter and then try again if the counter is under a threshold.

If you have a query that is causing a timeout you can set this variable by executing:

Where 300 is the number of seconds you think the maximum time the query could take.

Further information on how to deal with Mysql connection issues.

EDIT: Two other settings you may want to also use is net_write_timeout and net_read_timeout.

This error is occur due to expire of wait_timeout .

Just go to mysql server check its wait_timeout :

mysql> SHOW VARIABLES LIKE 'wait_timeout'

mysql> set global wait_timeout = 600 # 10 minute or maximum wait time out you need

On windows those guys using xampp should use this path xampp/mysql/bin/my.ini and change max_allowed_packet(under section[mysqld])to your choice size.e.g

Again on php.ini(xampp/php/php.ini) change upload_max_filesize the choice size.e.g

Gave me a headache for sometime till i discovered this. Hope it helps.

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.


For Vagrant Box, make sure you allocate enough memory to the box

The unlikely scenario is you have a router between the client and the server that forces TCP reset into the connection.

I had that issue, and I found our corporate F5 firewall was configured to terminate inactive sessions that is idle for more than 5 mins.

Once again, this is the unlikely scenario.

uncomment the ligne below in your my.ini/my.cnf, this will split your large file into smaller portion


In my case it was low value of open_files_limit variable, which blocked the access of mysqld to data files.

I checked it with :

After I changed the variable to big value, our server was alive again :

It was RAM problem for me.

I was having the same problem even on a server with 12 CPU cores and 32 GB RAM. I researched more and tried to free up RAM. Here is the command I used on Ubuntu 14.04 to free up RAM:

And, it fixed everything. I have set it under cron to run every hour.

And, you can use this command to check how much free RAM available:

And, you will get something like this:

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:

  2. files it must be 'localhost'.

Error 2006 (hy000) Mysql Server Has Gone Away Xampp

And last set:

Then restart Wampserver.

Mysql Server Has Gone Away Xampp

To change phpmyadmin user name and password

You can directly change the user name and password of phpmyadmin through file

Mysql Server Has Gone Away Xampp

These two lines

Here you can give new user name and password.After changes save the file and restart WAMP server.

Mysql Server Has Gone Away Xampp Error

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.

Mysql Server Has Gone Away Xampp How To

If you know you're going offline for a while, you can close your connection, do your processing, reconnect and write your reports.