Hi I am new to drupal and with in a month period we went from D6 to D7 and I am trying all of them. On D7 beta3, the whole installation went well. While I tried to create a content type, I noticed that my auto_nodetile (alpha one) was not enabled. When I tried to enable it I got the message below and I can not access my modules any more. can someone help? Thank you.

Additional uncaught exception thrown while handling exception.
Original
PDOException: SQLSTATE[HY000]: General error: 2006 MySQL server has gone away: SELECT * FROM {menu_router} WHERE path IN (:ancestors_0, :ancestors_1, :ancestors_2, :ancestors_3, :ancestors_4, :ancestors_5, :ancestors_6, :ancestors_7, :ancestors_8, :ancestors_9, :ancestors_10) ORDER BY fit DESC LIMIT 0, 1; Array ( [:ancestors_0] => admin/config/user-interface/uniform [:ancestors_1] => admin/config/user-interface/% [:ancestors_2] => admin/config/%/uniform [:ancestors_3] => admin/%/user-interface/uniform [:ancestors_4] => admin/config/user-interface [:ancestors_5] => admin/config/% [:ancestors_6] => admin/%/user-interface [:ancestors_7] => admin/%/% [:ancestors_8] => admin/config [:ancestors_9] => admin/% [:ancestors_10] => admin ) in menu_get_item() (line 426 of C:\xampp\htdocs\logm\includes\menu.inc).

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:802:"SQLSTATE[HY000]: General error: 2006 MySQL server has gone away: SELECT * FROM {menu_router} WHERE path IN (:ancestors_0, :ancestors_1, :ancestors_2, :ancestors_3, :ancestors_4, :ancestors_5, :ancestors_6, :ancestors_7, :ancestors_8, :ancestors_9, :ancestors_10) ORDER BY fit DESC LIMIT 0, 1; Array ( [:ancestors_0] => admin/config/user-interface/uniform [:ancestors_1] => admin/config/user-interface/% [:ancestors_2] => admin/config/%/uniform [:ancestors_3] => admin/%/user-interface/uniform [:ancestors_4] => admin/config/user-interface [:ancestors_5] => admin/config/% [:ancestors_6] => admin/%/user-interface [:ancestors_7] => admin/%/% [:ancestors_8] => admin/config [:ancestors_9] => admin/% [:ancestors_10] => admin ) ";s:9:"%function";s:15:"menu_get_item()";s:5:"%file";s:38:"C:\xampp\htdocs\logm\includes\menu.inc";s:5:"%line";i:426;s:14:"severity_level";i:3;} [:db_insert_placeholder_4] => 3 [:db_insert_placeholder_5] => [:db_insert_placeholder_6] => http://localhost/logm/admin/modules [:db_insert_placeholder_7] => [:db_insert_placeholder_8] => 127.0.0.1 [:db_insert_placeholder_9] => 1290443638 ) in dblog_watchdog() (line 155 of C:\xampp\htdocs\logm\modules\dblog\dblog.module).

--------------------------------------------------------------------------------

Uncaught exception thrown in session handler.
PDOException: SQLSTATE[HY000]: General error: 2006 MySQL server has gone away in _drupal_session_write() (line 204 of C:\xampp\htdocs\logm\includes\session.inc).

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

animelion’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.

banghouse’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