CommentFileSizeAuthor
#87 Screenshot at Aug 20 19-59-17.png238.6 KBvindesh
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

int’s picture

Category: bug » support

It's not Drupal 7 problem.

MySQL server has gone away
You have to find it in http://dev.mysql.com/doc/refman/5.1/en/gone-away.html

int’s picture

Status: Active » Fixed

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

tdeneke’s picture

Hi Int, thank you for your reply! I will check it.
Terufat

bryancasler’s picture

How to fix this problem

  • Go to xampp\mysql\bin
  • Open my.ini
  • Change "max_allowed_packet" from "1m" to "16m"
  • Save my.ini
  • Now restart MySql through the XAMPP control panel.

Found this solution here. http://minorpoint.blogspot.com/2007/09/mysql-server-has-gone-away.html

GuGuss’s picture

Issue tags: +MAMP MySQL

Hey ^^

I got the same issue with MAMP. Since MAMP 1.9.6, the my.cnf is not included. But you still can create your own my.cnf !

1 - Create a "my.cnf" file in "/Applications/MAMP/conf/", or copy one of the "*.cnf" files from "/Applications/MAMP/Library/support-files/" to "/Applications/MAMP/conf/" and rename it to "my.cnf".
2 - Add/Modify your settings in the "my.cnf" file.
3 - Save the "my.cnf" file.
4 - Restart the servers.

Tips : You don't need to add all the parameters in the "my.cnf" file. It can just be :

[mysqld]
max_allowed_packet = 32M
anthonyalbertyn’s picture

When I installed Open Public distribution (runs on Drupal 7) on local MAMP server and I clicked on Modules page then MySQL gave error "PDOException: SQLSTATE[HY000]: General error: 2006 MySQL server has gone away". Yes, this was a mysql configuration problem and not a Drupal bug. Change max_allowed_packet = 32M and adding this in a my.cnf file as suggested by #6 above worked for me. Thanks for your posts :-)

johnnydarkko’s picture

Thanks for that last tip GusGuss! Creating the my.cnf file and only having the max_allowed_packet defined did the trick for me.

creact’s picture

Excellent ! Fixed the problem in a jiffy...

bander2’s picture

I just want to bump this solution because there are a lot of other solutions on the googles that tell you to put the my.cnf file in other locations that didn't work for me. "/Applications/MAMP/conf/my.cnf" worked for me in 2.0. Thanks GuGuss!

dshields’s picture

I'll second bander2's comment.

I searched for a solution for this for a few hours before finally stumbling across the instruction to put the my.cnf file in the "/Applications/MAMP/conf/" directory. (I had tried putting it in many other suggested directories..)

After that, my site was back up and running smoothly.

Thanks GuGuss for the suggestion!

fairsayan’s picture

Thanks for that last tip GusGuss! Had the same issue and I solved it with your suggestion.

sam6’s picture

If anyone is using MAMP 2.0.x, the solution above will not work. One needs to edit the my.cnf & php.ini only via MAMP.

Stop your server, edit the templates in Mamp at Menu: File/Edit Templates/ save and restart the server.

aaronjay’s picture

Thanks. This fixed it for me!

payamspot’s picture

Thanks animelion. Post #5 worked for me.

phthao’s picture

I thank!

Nyunt Win Aung’s picture

Assigned: Unassigned » Nyunt Win Aung
Status: Closed (fixed) » Active

Thanks, #5 works for me.

inotafila’s picture

@animelion Thanks, yours tips work for me. :D

Letharion’s picture

Assigned: Nyunt Win Aung » Unassigned
Status: Active » Closed (fixed)
ahimsauzi’s picture

Thanks sam6, editing template file in MAMP 2.0.x worked!!

pipep’s picture

#6 also fixed this for me.

Thank you very much @GuGuss

kholloway’s picture

#6 worked for me as well. You guys are awesome. Thanks (:

DrupalDan’s picture

Hi folks, I run into a similiar error with "MySQL server has gone away".

PDOException: SQLSTATE[HY000]: General error: 2006 MySQL server has gone away: SELECT menu_links.* FROM {menu_links} menu_links WHERE (module = :db_condition_placeholder_0) AND (router_path = :db_condition_placeholder_1) ; Array ( [:db_condition_placeholder_0] => system [:db_condition_placeholder_1] => admin/config/content ) in admin_landing_page_access() (line 164 of C:\wamp\www\sites\all\modules\admin\admin.module).

Can anyone tell me what that means and how to fix this? I'm using WAMP and I already change the max_allowed_packet from 16M to 32M.

Thank you all in advance!

DGvNp0niToyRspXaaqx3PiQBMn66QXyAq5yrNHpz’s picture

Did you restart MySQL after making the change?

If not you may want to restart it from the command line or simply restart the application/your computer.

DrupalDan’s picture

Hi JoshuaPowell, thank you for the message. Yes, I restarted WAMP but it seems that it's not working after I made that change.

JamesPosko’s picture

#6 did the trick.

Thanks GuGuss.

Anonymous’s picture

This is all fine for local dev but I need to set this on a remote server (Hostgator). Any clues?

wbartussek’s picture

Version: 7.0-beta3 » 7.14
Category: support » bug
Status: Closed (fixed) » Active

In my case the error message left me absolutely in the dark. Then I remembered that I had installed new modules and that I might have forgotten to run the update database. Running update database finally solved the problem.

marcingy’s picture

Category: bug » support
Status: Active » Closed (fixed)
nexus666’s picture

Thanks GuGuss, worked like a charm!! :)

DeNelo’s picture

Thanks #5 animelion - worked nicely!

latulipeblanche’s picture

For Linux / XAMPP, based on #5
I did :

  • in terminal $ locate my.cnf
  • in terminal $ sudo gvim /opt/lampp/etc/my.cnf
  • Changed "max_allowed_packet" from "1m" to "16m"
  • saved my.cnf
  • Restart XAMPP with $ sudo /opt/lampp/lampp restart

Paul

sakilcse’s picture

Version: 7.14 » 7.18

I have the same problem today in MAMP.
#6 works for me.
Thanks.

lachokun’s picture

Thanks! Solution #5 worked like a charm! :D

predde’s picture

Try #13 if you're using MAMP 2.x.x. Fixed the problem for me. Thanks!

houstonaplus’s picture

#13 worked for me. Thanks!

mayur.pimple’s picture

Uncaught exception thrown in shutdown function.

PDOException: SQLSTATE[HY000]: General error: 2006 MySQL server has gone away: DELETE FROM {semaphore} WHERE (value = :db_condition_placeholder_0) ; Array ( [:db_condition_placeholder_0] => 169152141451dff8d4b69f78.07262902 ) in lock_release_all() (line 269 of C:\xampp\htdocs\glossy\includes\lock.inc).

Not Work for Me. I have try to set 32M in my.ini but not solve isssue.

Frank Ralf’s picture

You might find some hints at http://stackoverflow.com/questions/5058845/how-do-i-increase-the-stack-s...

Just another default setting which seems to differ between platforms.

hth
Frank

wyahl’s picture

PDOException: SQLSTATE[HY000]: General error: 2006 MySQL server has gone away: SELECT s.lid, t.translation, s.version FROM {locales_source} s LEFT JOIN {locales_target} t ON s.lid = t.lid AND t.language = :language WHERE s.source = :source AND s.context = :context AND s.textgroup = 'default'; Array ( [:language] => it [:source] => Administration [:context] => ) in locale() (line 720 of /Applications/MAMP/htdocs/FirstEclipse/drupal-7.23/modules/locale/locale.module).

Additional

PDOException: SQLSTATE[HY000]: General error: 2006 MySQL server has gone away: INSERT INTO {watchdog} (uid, type, message, variables, severity, link, location, referer, hostname, timestamp) VALUES (:db_insert_placeholder_0, :db_insert_placeholder_1, :db_insert_placeholder_2, :db_insert_placeholder_3, :db_insert_placeholder_4, :db_insert_placeholder_5, :db_insert_placeholder_6, :db_insert_placeholder_7, :db_insert_placeholder_8, :db_insert_placeholder_9); Array ( [:db_insert_placeholder_0] => 1 [:db_insert_placeholder_1] => php [:db_insert_placeholder_2] => %type: !message in %function (line %line of %file). [:db_insert_placeholder_3] => a:6:{s:5:"%type";s:12:"PDOException";s:8:"!message";s:382:"SQLSTATE[HY000]: General error: 2006 MySQL server has gone away: SELECT s.lid, t.translation, s.version FROM {locales_source} s LEFT JOIN {locales_target} t ON s.lid = t.lid AND t.language = :language WHERE s.source = :source AND s.context = :context AND s.textgroup = 'default'; Array ( [:language] => it [:source] => Administration [:context] => ) ";s:9:"%function";s:8:"locale()";s:5:"%file";s:79:"/Applications/MAMP/htdocs/FirstEclipse/drupal-7.23/modules/locale/locale.module";s:5:"%line";i:720;s:14:"severity_level";i:3;} [:db_insert_placeholder_4] => 3 [:db_insert_placeholder_5] => [:db_insert_placeholder_6] => http://localhost:8888/FirstEclipse/drupal-7.23/ [:db_insert_placeholder_7] => [:db_insert_placeholder_8] => 127.0.0.1 [:db_insert_placeholder_9] => 1377907559 ) in dblog_watchdog() (line 160 of /Applications/MAMP/htdocs/FirstEclipse/drupal-7.23/modules/dblog/dblog.module).

i tryied #6
i dont have the edit/template in my mamp
and i also tryied #38 where i noticed it says Windows... but i cant understand what to change http://stackoverflow.com/questions/5058845/how-do-i-increase-the-stack-s...

I dont know how to make it work, please some help!
Thanks for all the support i had before to Register Here.

augustomini’s picture

#5 worked for me. Thks

rickhocutt’s picture

#6 solution works (Ampps/conf/my.ini) if you use the AMPPS stack http://www.ampps.com

robertoperuzzo’s picture

I'm using MAMP Version 2.1.1
Solution #6 works

I copy /Applications/MAMP/Library/support-files/my-small.cnf file to /Applications/MAMP/conf/my.cnf
and change

[mysqld]
max_allowed_packet = 1M

to

[mysqld]
max_allowed_packet = 32M

kopeboy’s picture

Component: mysql database » ajax system

How can I do this if I'm on cloud hosting with cPanel?

ja09’s picture

#6 worked for me in MAMP 2.1.3, but only with the following 2 lines in my.cnf:

[mysqld]
max_allowed_packet = 32M

Also had to quit and relaunch MAMP for it to work. Stopping & starting the servers didn't work for me, tried quitting and it works great.

Thanks much!

brad.curnow’s picture

Thanks animelion, #5 worked for me.

udaykant’s picture

Thank you! so much. This has been solved my problem. Amazing!

udaykant’s picture

Thank you! so much. This has been solved my problem. Amazing! (:D)

irinaz’s picture

Thank you, this is great!

augbog’s picture

Running MAMP 3.0.5 and Drupal-7.28 and got this error. This worked for me. Thanks a lot @GuGuss

As mentioned, make sure you restart your MAMP server!

davidkp’s picture

PDO Exception Fixed

I was was getting this PDO Exception error when I was trying to add or edit a new content type.

I suspected the Token module was causing the problem as adding a new content type had been getting slower and slower. So after some searching I found some posts that confirmed using tokens creates a large overhead. This lead to me installing the Token Tweaks module which I configured to level 2 and this fixed my problem!

333martine’s picture

#5 worked for me. Thanks.

Larzan’s picture

AMPPS 2.1:
#5 fixed it for me:

In the AMPPS control panel go to MySQL->Configuration, search for
max_allowed_packet and change its value to at least 16M

gumdal’s picture

I am using XAMPP, it is fixed for me too, but my my.cnf file was in different location:

XAMPP/xamppfiles/etc/my.cnf

kvu@csusm.edu’s picture

WAMP 2.5, 64-bit version needs 1 extra step

If you are using WAMP 2.5, 64-bit version, you will notice a bug in which your changes in my.ini does not take effect. Inside my.ini, you need to change [wampmysqld] to [wampmysqld64]. Then, changing the max_allowed_packet should work, as it did for me.

portulaca’s picture

Thank you for the suggestions, it worked for me on CentOS too: changed max_allowed_packet to 32M

nano /etc/my.cnf

max_allowed_packet = 32M

service mysqld restart

Dusza’s picture

merkdit-mork’s picture

#5 fixed it for me. Many thanks!

mamourou’s picture

Hello , I load my drupal website via Fillezilla and it has received . When finished, in my browser I grabbed www.monsite.com/install.php to finalize the publication and once the party of choice for database I are mistakes once I selects the base all data by inserting the name of the database and password . What should I do please ?

ajaybhaskar’s picture

Hi,

I have follow the below guide line and resolved my problem.

  • Go to xampp\mysql\bin
  • Open my.ini
  • Change "max_allowed_packet" from "1m" to "16m"
  • Save my.ini
  • Now restart MySql through the XAMPP control panel.

Thanks

ZyverVenz’s picture

Hi,

Solved my problem

"max_allowed_packet" from "1m" to "250m"

Thanks guys

Huelfe’s picture

I've tried everything and I didn't get work, but then I took a look into the mysql_error.log:

[ERROR] InnoDB: The total blob data length (1066257) is greater than 10% of the total redo log size (10485760). Please increase total redo log size.

So I increased innodb_log_file_size from 5M to 256M in my.ini.

My changes in my.ini are

innodb_log_file_size = 256M

And under [mysqld] in my.ini:

max_allowed_packet = 100M

Now everything is working fine.

cilefen’s picture

nareshbw’s picture

Thanks comment# 5 helped me to resolve this issue .

scripter81’s picture

Thanks a lot to #5 it solved my issue.

dadderley’s picture

Thank you GusGuss for the tip in comment #6 above

I moved a Drupal (7.50) site from the production server to my local MAMP environment.
All was good until I went to start editing the menus.
Big MySQL errors.

PDOException: SQLSTATE[HY000]: General error: 2006 MySQL server has gone away

Your configuration

[mysqld]
max_allowed_packet = 32M

in a newly created file called 'my.cnf' and placed here:
/Applications/MAMP/conf/my.cnf

solved the problem.

amaperfect.com’s picture

Issue summary: View changes

I follow "bryancasler" instruction, it work thanks

hhetpanchal’s picture

I haven't done anything I just restarted my apache and mysql and it's working perfectly fine.

akozoriz’s picture

#6 solved problem for XAMPP

amaperfect.com’s picture

Thanks animelion, post #5 worked for drupal 7.

gambithi’s picture

I have MariaDb and the problem was solved with the command into that :

SET GLOBAL max_allowed_packet = 1024 * 1024 * 512;

zakalkar’s picture

Thanks a lot, it works...

Girum’s picture

-> Xamp->Mysql->Bin/my.ini
change
max_allowed_packet = 1M
to
max_allowed_packet = 16M

save!
done reload
xamp

# The MySQL server
[mysqld]
basedir = "C:/xampp/mysql/"
datadir = "C:/xampp/mysql/data/"
port = 3306
socket = "MySQL"
skip-locking
key_buffer = 16M
max_allowed_packet = 16M
table_cache = 64
sort_buffer_size = 512K
net_buffer_length = 8K
read_buffer_size = 256K
read_rnd_buffer_size = 512K
myisam_sort_buffer_size = 8M

garryh’s picture

Just saw this error for the first time. Huge thanks to #6 & #7 for helping me solve this quickly.

calefilm’s picture

Using MAMP Version 3.5
#6 did the trick for me too. Thanks GuGuss!

zeev’s picture

#6 worked

imkartik’s picture

+1 to #5

arv.drupal’s picture

#5 worked for me. Thanks

pillona’s picture

When you cannot increase the max_allowed_packet (due to constraints from your hosting company for example), and if the problem is with a table which is big (check in phpMyAdmin), you may meet success by reducing the table size.

- usually it will happen it a table that you can clear entirely (sessions, watchdogs, searchindex) before performing the query (like a big update...)
- or you can clean this table, for example deleting old revisions from node_revision table

See https://www.drupal.org/project/drupal/issues/1014172#comment-12794739

Chamikara.k’s picture

#6 worked !

Partha Sarathi’s picture

Thanks @bryancasler
it worked for me.

pachabhaiya’s picture

+1 to #5 and #6.

kareemzok’s picture

#6, #5 worked.
Thanks !!

markpape’s picture

#6 worked on Drupal 7.63

destash’s picture

#6, #5 worked.
Thanks all i

kumar.work007’s picture

Version: 7.18 » 10.0.x-dev

@bryancasler #5
Thanks it worked for me
How to fix this problem

Go to xampp\mysql\bin
Open my.ini
Change "max_allowed_packet" from "1m" to "16m"
Save my.ini
Now restart MySql through the XAMPP control panel.

vindesh’s picture

[Thu Aug 20 19:43:07.223888 2020] [php7:notice] [pid 1494] [client 127.0.0.1:52330] Drupal\\Core\\Database\\DatabaseExceptionWrapper: SQLSTATE[HY000]: General error: 2006 MySQL server has gone away: INSERT INTO {cache_bootstrap} (cid, expire, created, tags, checksum, data, serialized) VALUES (:db_insert_placeholder_0, :db_insert_placeholder_1, :db_insert_placeholder_2, :db_insert_placeholder_3......

I had the similar problem and increasing the max_allowed_packet to 128M/512M in mysqld section of my.cnf conf file has solved the error

Set in my.cnf configuration file
In /etc/my.cnf, change variables like:
$ sudo nano /etc/my.cnf
-----------------------------
[mysqld]
max_allowed_packet=512M

-----------------------------
If you do not find my.cnf file on your machine than you can create my.cnf conf file and write above code.
mysql Ver 14.14 Distrib 5.7.28, for macos10.14 (x86_64) using EditLine wrapper
macOS Catalina
Version: 10.15.3

OR
From command line login to mysql
$ mysql -u root -p
Enter password:
mysql> SET GLOBAL max_allowed_packet = 1024 * 1024 * 512;
its done.

Restart MYSQL: service mysqld restart

It is working for me.

Check the updated variable value on your phpmyadmin variable list.

cilefen’s picture

Title: PDOException: SQLSTATE[HY000]: General error: 2006 MySQL server has gone away: drupal 7 beta3 » Not setting max_allowed_packet in MySQL according to installation requirements can lead to PDOException: SQLSTATE[HY000]: General error: 2006 MySQL server has gone away
Version: 10.0.x-dev » 9.1.x-dev
thomaswalther’s picture

SET GLOBAL max_allowed_packet = 1024 * 1024 * 512; ​and restart help, yes.

But:
A restart helps for a certain time. After a while, the error occurs again. Only restarting helps again. But the cause was not solved, right?

nicklundy’s picture

Just in case anyone else finds this issue, apparently you can receive this error also when trying to connect to MySQL on the wrong port number.
"PDOException: SQLSTATE[HY000]: General error: 2006 MySQL server has gone away"