#2006 - MySQL server has gone away

Problems with the Windows version of XAMPP, questions, comments, and anything related.

#2006 - MySQL server has gone away

Postby morfasto » 04. October 2011 20:57

Hello, I just migrated from v1.7.4 to v1.7.7 and I started to get a problem that I never had before.

Eveytime I use phpMyAdmin or PHP code to insert or update a registry on a table I get this msg:

    On phpMyAdmin:
      #2006 - MySQL server has gone away

    On the browser using PHP code:
      Warning: mysql_query() [function.mysql-query]: MySQL server has gone away in C:\xampp\htdocs\add_user.php on line 20

      Warning: mysql_query() [function.mysql-query]: Error reading result set's header in C:\xampp\htdocs\add_user.php on line 20
      Error: MySQL server has gone away

It cuts the connection with the server and doesn't allow to complete the task.

I'm using: Windows 7 Ultimate 64bit SP1.

How may I solve this issue?


Posts: 5
Joined: 04. October 2011 20:49

Re: #2006 - MySQL server has gone away

Postby Sharley » 04. October 2011 23:05

What specific application are you using that relates to the add_user.php file?

You may have this issue because your databases are now fairly large and so the settings in the \xampp\mysql\bin\my.ini file are inadequate and so the server triggers a time out.

The default my.ini file assumes low resources and is based on the my-small.ini found in the \xampp\mysql folder and so this may not suit your particular needs.

Remember to make a backup of any file you edit in XAMPP before editing.
Find and edit these settings in the \xampp\mysql\bin\my.ini file, so they look like this
Code: Select all

key_buffer = 384M
max_allowed_packet = 64M
table_cache = 4096
sort_buffer_size = 2M
read_buffer_size = 2M
read_rnd_buffer_size = 64M
myisam_sort_buffer_size = 64M
thread_cache_size = 8
query_cache_size = 32M

innodb Specific

innodb_buffer_pool_size = 384M
innodb_additional_mem_pool_size = 20M
innodb_log_file_size = 10M
innodb_log_buffer_size = 64M
innodb_flush_log_at_trx_commit = 1
innodb_lock_wait_timeout = 180

MySql provides sample configuration files within its package (called in Windows "my-huge.ini" , "my-innodb-heavy-4G.ini" , "my-large.ini" , etc). They are to be found in the \xampp\mysql folder. Browse them and determine by yourself what suits you (and your system) best.

You can rename the existing my.ini to my_orig.ini and then copy the one that best suits into the bin folder and rename it to my.ini then edit it and copy over the XAMPP specific entries from my_orig.ini file.

Save the file and restart MySQL, clear your browser's temporary files (cache) and check again what brought on the error message.

Remember you always have your original backup my.ini if all goes pear shaped after editing.

Here is what MySQL Dev have to say about it (mostly in geek speak though). :)

I hope this helps and please post some feedback one way or the other. 8)

Good luck. :)
User avatar
AF Moderator
Posts: 3316
Joined: 03. October 2008 05:10
Location: Yeppoon, Australia Time Zone: GMT/UTC+10
Operating System: Win 7 Pro 32bit/XP Pro SP3

Re: #2006 - MySQL server has gone away

Postby morfasto » 04. October 2011 23:50

Thank you for your answer.

I found the problem. I forgot to export my database before desintalling the v1.7.4 and I copied the .frm files to the v1.7.7. Seems like that doesnt work well. I recreated my database and my tables and now everything is working just fine.

Posts: 5
Joined: 04. October 2011 20:49

Return to XAMPP for Windows

Who is online

Users browsing this forum: No registered users and 72 guests