The description below is fine for a developer but leaves an ordinary user completely in the dark. They have no clue what they should do. In this case just hitting refresh fixed things. That is what ordinary users should see. Something like

System failure. Try refreshing the screen.
------------------------------
Additional uncaught exception thrown while handling exception.
Original

PDOException: SQLSTATE[HY000]: General error: 2006 MySQL server has gone away: SELECT source FROM {url_alias} WHERE alias = :alias AND language IN (:language, :language_none) ORDER BY language ASC, pid DESC; Array ( [:alias] => node/2 [:language] => en [:language_none] => und ) in drupal_lookup_path() (line 177 of /home/yktdan/public_html/includes/path.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:286:"SQLSTATE[HY000]: General error: 2006 MySQL server has gone away: SELECT source FROM {url_alias} WHERE alias = :alias AND language IN (:language, :language_none) ORDER BY language ASC, pid DESC; Array ( [:alias] => node/2 [:language] => en [:language_none] => und ) ";s:9:"%function";s:20:"drupal_lookup_path()";s:5:"%file";s:42:"/home/yktdan/public_html/includes/path.inc";s:5:"%line";i:177;s:14:"severity_level";i:3;} [:db_insert_placeholder_4] => 3 [:db_insert_placeholder_5] => [:db_insert_placeholder_6] => http://www.danielsweb.info/ [:db_insert_placeholder_7] => [:db_insert_placeholder_8] => 108.21.188.154 [:db_insert_placeholder_9] => 1297532414 ) in dblog_watchdog() (line 155 of /home/yktdan/public_html/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 /home/yktdan/public_html/includes/session.inc).

Files: 
CommentFileSizeAuthor
#14 my.ini_.patch5.5 KBHardik C
#15 my.ini_.patch5.5 KBHardik C

Comments

madhavvyas’s picture

Issue tags: +database

I am also facing same problem in my project. I had configured drupal 7 in my local window machine. Sometimes page become blank and by pressing F5 it comes again.

some times I found same error message in my project.

Please give me solution....

madhavvyas’s picture

Status: Active » Closed (fixed)
yktdan’s picture

That may make the event not happen, but it doesn't address the UX issue of telling the ordinary user what to do. All error messages should start out with advice to an ordinary user of what they should do. They can then put up more info that pertains to a system administrator, labeled as such so the ordinary user can ignore it. The other side of this coin is the obnoxious "Ask your system administrator.", but what if I am the system administrator? There are no clues about what to do next. I am sure that more info was available in the code where the error message was formatted and could have been included.

mcsolas’s picture

Just ran into this error message the day we were launching. Urgently seeking a solution.

deejayrig’s picture

im in the same boat! Help! called go daddy and a tacky as heck guy was playing the smart ass instead of helping....

deejayrig’s picture

Additional uncaught exception thrown while handling exception.
Original
PDOException: SQLSTATE[42S22]: Column not found: 1054 Unknown column 's.context' in 'field list': SELECT s.source, s.context, t.translation, t.language FROM {locales_source} s LEFT JOIN {locales_target} t ON s.lid = t.lid AND t.language = :language WHERE s.textgroup = 'default' AND s.version = :version AND LENGTH(s.source) < :length; Array ( [:language] => es [:version] => 7.0 [:length] => 75 ) in locale() (line 641 of /home/content/e/m/p/empresarial/html/jesucristo/modules/locale/locale.module).

Additional
PDOException: SQLSTATE[42S22]: Column not found: 1054 Unknown column 's.context' in 'where clause': 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] => es [:source] => %type: !message in %function (line %line of %file). [:context] => ) in locale() (line 659 of /home/content/e/m/p/empresarial/html/jesucristo/modules/locale/locale.module).

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

Uncaught exception thrown in session handler.
PDOException: SQLSTATE[42S22]: Column not found: 1054 Unknown column 'ssid' in 'where clause': SELECT 1 AS expression FROM {sessions} sessions WHERE ( (sid = :db_condition_placeholder_0) AND (ssid = :db_condition_placeholder_1) ) FOR UPDATE; Array ( [:db_condition_placeholder_0] => Ri-OqzL8V5-vEMMfV9Xl-fqNC4jTJiq9pIF-1QlHS4k [:db_condition_placeholder_1] => ) in _drupal_session_write() (line 204 of /home/content/e/m/p/empresarial/html/jesucristo/includes/session.inc).

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

mcsolas’s picture

I was able to resolve mine after updating to the current beta of the media module + banner rotation modules.

From what I understand the media module is changing rapidly. there is a chance that you auto-updated your site to a newer version of a module incompatible with your current version of the media module. thats how I got myself in trouble. : )

BassPlaya’s picture

Dear yktdan,

I understand that you want to point out the problem to drupal core developing developers but would you be so kind to tell us here what this issue is about as it seems that you are aware of the fact that the ordinary user is left in the dark. And if you know how to resolve this issue, would you please share it with us? We would all much appreciate it. Thank you.

yktdan’s picture

I no longer remember any details about what I was doing that caused me to get the error message, and likely at this point many months later, that particular bug is gone. My issue is purely a UX issue about how to write error messages so that all levels of users from non-techy user, to site admin user, to developer, all get messages at a level of detail that is relevant and understandable by them. This particular one, was probably only understandable by a developer.

anschinsan’s picture

In case another is desperate to find a fast solution for this error. It can be a solution to set the max_allowed_packet value in your my.cnf or my.ini to a higher value. As default value on installation this is often set to 1 M but for a drupal 7 installation with a lot of modules this can be insufficient.

jggarley’s picture

where's the .cnf file located? i'm working on a localhost

BassPlaya’s picture

In case you are working with MAMP it's located in Applications/MAMP/Library/support-files/my-small.cnf . You should create a copy of the cnf file you wish to use and rename it as my.cnf and place it in the folder Applications/MAMP/Library/

And if you're looking for the php.ini file (I haven't heard of my.ini file though) you can change the settings under (again MAMP):
/Applications/MAMP/bin/php/php5.3.6/conf/php.ini

or if you are still running an older version of php:
/Applications/MAMP/bin/php/php5.2.17/conf/php.ini

Let us know if that works.

youring’s picture

It works! Thanks!
I use xampp on windows 7. Encountered the same problem.
Changed max_allowed_packet to 20M in xampp\mysql\bin\my.ini , finish.

Hardik C’s picture

FileSize
5.5 KB

Hi,

There are also some changes need to be required in my.ini file. Please refer the attachments.

Hardik C’s picture

FileSize
5.5 KB

Hi,

You can make the changes in code in my.ini with reference of attached patch.

Masa Nishio’s picture

Here my personal experience as a non-expert, just for those who are using a shared hosting, just like I am:

I got the above error message (General error: 2006 MySQL server has gone away) last night, out of the blue (I didn't do anything to my website).

I asked my hosting service provider if I or they could change MySQL's max_allowed_packet setting in my my.cnf to a larger value. They said "No".

So I went to the control panel page for my website and backed up my database (just clicked the "backup" button).

After having checked that the backup file is there, I restored the database (by clicking the "restore" button).

After a couple of minutes my website was running again as if there hadn't been any problem at all. :)

Please note, however, that I can't guarantee that the above procedure will work for other cases.

uzairasuknow’s picture

I came across the same issue and fixed it by increasing the 'max_allowed_packet' limit to '16M'

here are the steps i followed on my xampp, localhost

  1. Go to xampp\mysql\bin
  2. Open my.ini
  3. Change "max_allowed_packet" from "1m" to "16m" (or larger)
  4. Save my.ini Now restart MySql through the XAMPP control panel.
Mholtmeier’s picture

Upping the max_allowed_packet does not work for me. I still get:

PDOException: SQLSTATE[HY000]: General error: 2006 MySQL server has gone away: SELECT nt.* FROM {node_type} nt WHERE (disabled = :db_condition_placeholder_0) ORDER BY nt.type ASC; Array ( [:db_condition_placeholder_0] => 0 ) in _node_types_build() (line 703 of C:\xampp\htdocs\drupal\modules\node\node.module).

Any ideas? This is on localhost with XAMPP as well... I'm worried that even if I fix it here I'll face the same problem when I go live?

Anonymous’s picture

hi i have the same issue but its even worst i can't access my content menu and can't run cron please help my job depends on it

Additional uncaught exception thrown while handling exception.

Original

PDOException: SQLSTATE[HY000]: General error: 2006 MySQL server has gone away: SELECT uid, name, picture, data FROM {users} WHERE uid IN (:uids_4, :uids_34, :uids_35, :uids_36, :uids_37, :uids_38, :uids_39, :uids_41, :uids_42, :uids_44, :uids_55, :uids_56, :uids_57, :uids_58, :uids_59, :uids_78, :uids_79, :uids_80, :uids_81, :uids_83, :uids_85, :uids_96, :uids_97, :uids_98, :uids_101, :uids_107, :uids_110, :uids_113, :uids_120, :uids_129, :uids_135, :uids_138, :uids_140, :uids_142, :uids_143, :uids_144, :uids_150, :uids_151, :uids_152, :uids_166, :uids_167, :uids_168, :uids_173, :uids_182, :uids_183, :uids_185, :uids_186, :uids_187, :uids_188, :uids_190); Array ( [:uids_4] => 1 [:uids_34] => 1 [:uids_35] => 1 [:uids_36] => 1 [:uids_37] => 1 [:uids_38] => 1 [:uids_39] => 1 [:uids_41] => 1 [:uids_42] => 1 [:uids_44] => 1 [:uids_55] => 1 [:uids_56] => 1 [:uids_57] => 1 [:uids_58] => 1 [:uids_59] => 1 [:uids_78] => 7 [:uids_79] => 7 [:uids_80] => 7 [:uids_81] => 7 [:uids_83] => 7 [:uids_85] => 7 [:uids_96] => 7 [:uids_97] => 7 [:uids_98] => 7 [:uids_101] => 7 [:uids_107] => 7 [:uids_110] => 7 [:uids_113] => 7 [:uids_120] => 7 [:uids_129] => 7 [:uids_135] => 7 [:uids_138] => 7 [:uids_140] => 7 [:uids_142] => 7 [:uids_143] => 7 [:uids_144] => 7 [:uids_150] => 7 [:uids_151] => 7 [:uids_152] => 15 [:uids_166] => 7 [:uids_167] => 7 [:uids_168] => 7 [:uids_173] => 7 [:uids_182] => 15 [:uids_183] => 15 [:uids_185] => 15 [:uids_186] => 15 [:uids_187] => 15 [:uids_188] => 15 [:uids_190] => 15 ) in user_node_load() (line 3563 of /var/www/html/modules/user/user.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] => 7 [: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:1843:"SQLSTATE[HY000]: General error: 2006 MySQL server has gone away: SELECT uid, name, picture, data FROM {users} WHERE uid IN (:uids_4, :uids_34, :uids_35, :uids_36, :uids_37, :uids_38, :uids_39, :uids_41, :uids_42, :uids_44, :uids_55, :uids_56, :uids_57, :uids_58, :uids_59, :uids_78, :uids_79, :uids_80, :uids_81, :uids_83, :uids_85, :uids_96, :uids_97, :uids_98, :uids_101, :uids_107, :uids_110, :uids_113, :uids_120, :uids_129, :uids_135, :uids_138, :uids_140, :uids_142, :uids_143, :uids_144, :uids_150, :uids_151, :uids_152, :uids_166, :uids_167, :uids_168, :uids_173, :uids_182, :uids_183, :uids_185, :uids_186, :uids_187, :uids_188, :uids_190); Array ( [:uids_4] =&gt; 1 [:uids_34] =&gt; 1 [:uids_35] =&gt; 1 [:uids_36] =&gt; 1 [:uids_37] =&gt; 1 [:uids_38] =&gt; 1 [:uids_39] =&gt; 1 [:uids_41] =&gt; 1 [:uids_42] =&gt; 1 [:uids_44] =&gt; 1 [:uids_55] =&gt; 1 [:uids_56] =&gt; 1 [:uids_57] =&gt; 1 [:uids_58] =&gt; 1 [:uids_59] =&gt; 1 [:uids_78] =&gt; 7 [:uids_79] =&gt; 7 [:uids_80] =&gt; 7 [:uids_81] =&gt; 7 [:uids_83] =&gt; 7 [:uids_85] =&gt; 7 [:uids_96] =&gt; 7 [:uids_97] =&gt; 7 [:uids_98] =&gt; 7 [:uids_101] =&gt; 7 [:uids_107] =&gt; 7 [:uids_110] =&gt; 7 [:uids_113] =&gt; 7 [:uids_120] =&gt; 7 [:uids_129] =&gt; 7 [:uids_135] =&gt; 7 [:uids_138] =&gt; 7 [:uids_140] =&gt; 7 [:uids_142] =&gt; 7 [:uids_143] =&gt; 7 [:uids_144] =&gt; 7 [:uids_150] =&gt; 7 [:uids_151] =&gt; 7 [:uids_152] =&gt; 15 [:uids_166] =&gt; 7 [:uids_167] =&gt; 7 [:uids_168] =&gt; 7 [:uids_173] =&gt; 7 [:uids_182] =&gt; 15 [:uids_183] =&gt; 15 [:uids_185] =&gt; 15 [:uids_186] =&gt; 15 [:uids_187] =&gt; 15 [:uids_188] =&gt; 15 [:uids_190] =&gt; 15 ) ";s:9:"%function";s:16:"user_node_load()";s:5:"%file";s:38:"/var/www/html/modules/user/user.module";s:5:"%line";i:3563;s:14:"severity_level";i:3;} [:db_insert_placeholder_4] => 3 [:db_insert_placeholder_5] => [:db_insert_placeholder_6] => http://www.icare.com/admin/content [:db_insert_placeholder_7] => http://www.icare.com/admin/modules [:db_insert_placeholder_8] => 173.162.124.90 [:db_insert_placeholder_9] => 1340815281 ) in dblog_watchdog() (line 157 of /var/www/html/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 206 of /var/www/html/includes/session.inc).

collinsfm316’s picture

Assigned: Unassigned » collinsfm316

@ #19 : Try truncating "cache_update" table in the database. It worked for me.

Anonymous’s picture

hey thanks for the reply i found out the node i created gave me an error and the only way to fix it it was going inside the database phpmyadmin and erase that node as for the error i think it happened because i dropped a couple of images through ckeditor and after that couldnt access the content area

seren10pity’s picture

#2 : Here is the direct link to the post http://madhavvyas.blogspot.fr/2011/04/sqlstatehy000-general-error-2006-mysql.html

And it worked for me, thank you madhavvyas ;)

IreneKraus’s picture

I'm running into this rather frequently in trying to do a site re-build on my test server (virtual install of Ubuntu running LAMPP). All I am doing at this point is enabling modules at this point, so I've been wondering if there is a timing (memory) issue going on somewhere. I know there used to be a tweak I had to do for my installs of XAMPP when I was running that on my Windows machine to resolve oddball memory issues. Even worse, I can't find my notes on this as it has been such a long time since I've run into this since going to the virtual install. I could have sworn it involved modifying the .htaccess file found in the Drupal root directory, but I don't see that in these installs for Drupal 7.

Oh, and just doing a refresh of the page is NOT getting rid of the error as someone indicated at the top of this issue report.

Snufkinski’s picture

#2 #22

It worked for me, too.
add following line in /etc/my.cnf (CentOS 5.8)

max_allowed_packet = 128M

thank you very much, madhavvyas and seren10pity ;)

makokis’s picture

using MAMP, do no works for me, problem stills

i am getting crazy with this error ¡¡¡

IreneKraus’s picture

I guess I'm dealing with something different than most users. The errors I am getting always start with this:

PDOException: SQLSTATE[HY000]: General error: 145 Table '.\field_revision_body' is marked as crashed and should be repaired: 

PDOException: SQLSTATE[HY000]: General error: 145 Table '.\field_revision_body' is marked as crashed and should be repaired:

Repairing the table in question always produces a fix thru PHPAdmin, until it strikes again. Again, as this is occurring on my test server I still feel it to be some sort of memory/timing issue where the MySQL server glitches during the save. In any case, as this is still on my test server I can certainly try madhavvyas idea to see if it helps any.
My biggest concern is that if this is still going on once the site is fully re-built in Drupal 7 and moved out to the production site, where users will be interacting with it. I have been tracking these errors for a while now and it does seem to always involve that one table too. Yes, the Revision module is used on this site to provide moderation so this all could tie back to that rather than the Drupal core. That is, if it really is the fault of any code and not an issue with the MySQL server configuration.

Reco-X’s picture

I have this error:

Additional uncaught exception thrown while handling exception.

Original

PDOException: SQLSTATE[HY000]: General error: 2006 MySQL server has gone away: SELECT * FROM {commerce_flat_rate_service}; Array ( ) in commerce_flat_rate_commerce_shipping_service_info() (line 120 of C:\xampp\htdocs\comercio\profiles\commerce_kickstart\modules\contrib\commerce_flat_rate\commerce_flat_rate.module).

Additional

PDOException: SQLSTATE[HY000]: General error: 2006 MySQL server has gone away: SELECT ff.* FROM {filter_format} ff WHERE (status = :db_condition_placeholder_0) ORDER BY weight ASC; Array ( [:db_condition_placeholder_0] => 1 ) in filter_formats() (line 409 of C:\xampp\htdocs\comercio\modules\filter\filter.module).

Uncaught exception thrown in session handler.

PDOException: SQLSTATE[HY000]: General error: 2006 MySQL server has gone away in _drupal_session_write() (line 209 of C:\xampp\htdocs\comercio\includes\session.inc).

cumpatomas’s picture

Hello, I'm a very new user

I've solved this ERROR ("Additional uncaught exception thrown while handling exception") it because my problem was that when I tried to IMPORT my DATA BASE from PHPmyAdmin using the free hosting 000webhost it imported only SOME tables but not ALL of them (I don't know why) so I resolved it exporting my data base in 2 files and then I imported them from PHPmyAdmin. I used de bzip format because another problem was that if I didn't compressed the file of my DB the IMPORT didn't worked.

Note: AAA DON'T FORGET TO CHANGE THE "SETTINGS.PHP" FILE TO CHANGE DE SERVER FIELDS OF COURSE!

Hope this comment is usefull

cheers

junaid2001’s picture

how to fix this problem with having cpanel access only?

mosby’s picture

I'm using LAMP (Ubuntu 12:04) as my development environment. I solved the problem by:

Open a terminal window and run: sudo gedit /etc/mysql/my.cnf
Find the line that reads 'max_allowed_packet = 16M'
Modify so that the line reads 'max_allowed_packet = 128M' (I read earlier in the thread however that anything above 48M for this setting would be okay).
Save changes to my.cnf and close gedit

Restart mysql with command: sudo /etc/init.d/mysql restart or sudo service mysql restart

Anyone know a cleaner method? I'm always excited to learn!!!

bole’s picture

Thank you so!! Good solution for me ;-)
*****
Muchas gracias!! Buena solucion para mi ;-)

ste_barrett’s picture

Thanks madhavvyas - resolving the 206 error as per http://madhavvyas.blogspot.com/ worked for me too. It may be worth pointing out for anyone using MAMP PRO you make the change by going MAMP PRO > File > Edit Template > MySQL my.cnf and making the change there.

jim22’s picture

#30 and #32 worked for me. THANKS!!!

tugal’s picture

Hi. I'm using XAMPP on windows 7 but also facing same problem in my project. I had configured drupal 7 in my local window machine and working localhost

*************************************************************************************

Additional uncaught exception thrown while handling exception.
Original

PDOException: SQLSTATE[HY000]: General error: 2006 MySQL server has gone away: SELECT COUNT(*) AS expression FROM (SELECT 1 AS expression FROM {trigger_assignments} trigger_assignments) subquery; Array ( ) in trigger_menu_unassign_access() (line 92 of C:\xampp\htdocs\leas\modules\trigger\trigger.module).
Additional

PDOException: SQLSTATE[HY000]: General error: 2006 MySQL server has gone away: SELECT ff.* FROM {filter_format} ff WHERE (status = :db_condition_placeholder_0) ORDER BY weight ASC; Array ( [:db_condition_placeholder_0] => 1 ) in filter_formats() (line 409 of C:\xampp\htdocs\leas\modules\filter\filter.module).
Uncaught exception thrown in session handler.

PDOException: SQLSTATE[HY000]: General error: 2006 MySQL server has gone away in _drupal_session_write() (line 209 of C:\xampp\htdocs\leas\includes\session.inc).
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] => 891197515512ec606cc0af4.11303133 ) in lock_release_all() (line 269 of C:\xampp\htdocs\leas\includes\lock.inc).

Jausan’s picture

Error 2006 is very common in Drupal 7 but not a problem with the build as some speculate.

Symptoms:

Original

PDOException: SQLSTATE[HY000]: General error: 2006 MySQL server has gone away: DELETE FROM {cache} WHERE (cid LIKE :db_condition_placeholder_0 ESCAPE '\\') ; Array ( [:db_condition_placeholder_0] => entity\_info:% ) in cache_clear_all() (line 163 of D:\wamp\www\dev7\includes\cache.inc).

Additional

PDOException: SQLSTATE[HY000]: General error: 2006 MySQL server has gone away: SELECT filename FROM {registry} WHERE name = :name AND type = :type; Array ( [:name] => OgMembershipTypeUIController [:type] => interface ) in _registry_check_code() (line 3091 of D:\wamp\www\dev7\includes\bootstrap.inc).

Primary Problem:

1) The server timed out and closed the connection which is the most common cause.

Solutions to Problem 1:

1) The first thing to check is the wait_timeout variable in the my.cnf or my.ini config file. You may need to increase the time for it to work. By just increasing the memory allocation may allow more data through-put but may not provide enough time window for the data to be processed. You may try setting the wait_timeout to about 600 seconds and adjust it even higher once error 2006 has vanished. When you restart mysql the wait_timeout should be near 28800 seconds or just about 8 hours or so.

2) The server might have received a package of data too large to process which is the second common problem. The best way to resolve this common problem is to go into the my.cnf or my.ini files and change the max_allowed_packet to 64M and that should resolve the problem. It is best to do both in order to resolve this issue.

phthao’s picture

I use Vertrigo
Open file ..\VertrigoServ\Mysql\mi.ini
Config my.ini

----------------------------------
[mysqld]
basedir=F:\VertrigoServ\Mysql\
datadir=F:\VertrigoServ\Mysql\data\
port =3306
key_buffer =16M
max_allowed_packet =32M
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

[mysqldump]
quick
max_allowed_packet =32M

[mysql]
no-auto-rehash
# Remove the next comment character if you are not familiar with SQL
#safe-updates

[isamchk]
key_buffer =20M
sort_buffer_size =20M
read_buffer =2M
write_buffer =2M

[myisamchk]
key_buffer =20M
sort_buffer_size =20M
read_buffer =2M
write_buffer =2M

[mysqlhotcopy]
interactive-timeout
----------------------------------

XTCHost’s picture

Worked for me adding - max_allowed_packet = 128M to /etc/my.cnf on centos

mysqld]
max_allowed_packet = 128M
innodb_file_per_table=1
open_files_limit=26758
query_cache_size = 128M # (>= 8M)
tmp_table_size = 256M # (> 16M)
max_heap_table_size = 256M # (> 16M)
thread_cache_size = 12 #(start at 4)
table_cache = 2000 #(> 400)
innodb_buffer_pool_size = 900M # (>= 828M)
[mysqld]
datadir=/var/lib/mysql
socket=/tmp/mysql.sock
[client]
socket=/tmp/mysql.sock

Thanks....

basscleff94010’s picture

I am having the same problem with a fresh install of OpenAcademy distribution of Drupal 7 on MAMP desktop.

Using the comments so far, this is a summary of the results:

I changed all occurrences of "max_allowed_packets" to 192M in all files (7) on my system.

I changed all occurences of "wait_timeout" to 600 in all files (1) on my system

Now the error message on loading the landing page has changed to:

Uncaught exception thrown in session handler.

PDOException: SQLSTATE[HY000]: General error: 2006 MySQL server has gone away in _drupal_session_write() (line 209 of /Applications/MAMP/htdocs/includes/session.inc).

Here is the error log:

thrown in /Applications/MAMP/htdocs/includes/database/database.inc on line 2168
[11-Sep-2013 09:09:50 America/Los_Angeles] PHP Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE[HY000]: General error: 2006 MySQL server has gone away' in /Applications/MAMP/htdocs/includes/database/database.inc:2168
Stack trace:
#0 /Applications/MAMP/htdocs/includes/database/database.inc(2168): PDOStatement->execute(Array)
#1 /Applications/MAMP/htdocs/includes/database/database.inc(680): DatabaseStatementBase->execute(Array, Array)
#2 /Applications/MAMP/htdocs/includes/database/database.inc(2347): DatabaseConnection->query('SELECT expire, ...', Array, Array)
#3 /Applications/MAMP/htdocs/includes/lock.inc(167): db_query('SELECT expire, ...', Array)
#4 /Applications/MAMP/htdocs/includes/lock.inc(146): lock_may_be_available('schema:runtime:...')
#5 /Applications/MAMP/htdocs/includes/bootstrap.inc(424): lock_acquire('schema:runtime:...')
#6 /Applications/MAMP/htdocs/includes/bootstrap.inc(446): DrupalCacheArray->set(Array)
#7 [internal function]: DrupalCacheArray->__destruct()
#8 {main}
thrown in /Applications/MAMP/htdocs/includes/database/database.inc on line 2168

Unfortunately, it doesn't give me any insight into the problem.

I'd appreciate any more suggestions.

Mehrdad201’s picture

I have the same problem only when I want to add a submenu in menu section.

But my site in running on shared server and I am not allowed to edit my.cnf (configuration for mysql).

I cleared the cache and truncated all cache tables via phpmyadmin and also disabled log in drupal but problem is not gone :(

what should I do ?

medicvillain’s picture

I am running on XAMPP trying to install open atrium. This exception is thrown. I have changed the my.ini file and the php.ini file with suggested updates.

Is it just a particularly huge data packet? I have set it to 128M

Anyone with any ideas, would really appreciate any help

Additional uncaught exception thrown while handling exception.
Original

PDOException: SQLSTATE[42S02]: Base table or view not found: 1146 Table 'openatrium.taxonomy_vocabulary' doesn't exist: SELECT name, machine_name, vid FROM {taxonomy_vocabulary}; Array ( ) in taxonomy_vocabulary_get_names() (line 991 of C:\xampp\htdocs\openatrium\modules\taxonomy\taxonomy.module).
Additional

PDOException: SQLSTATE[42S02]: Base table or view not found: 1146 Table 'openatrium.taxonomy_vocabulary' doesn't exist: SELECT name, machine_name, vid FROM {taxonomy_vocabulary}; Array ( ) in taxonomy_vocabulary_get_names() (line 991 of C:\xampp\htdocs\openatrium\modules\taxonomy\taxonomy.module).

priyankprajapati’s picture

where i add this patch file ??

in which directory i add this patch ?
give me directory location to add this patch file.

please help me its urgent..

opp67’s picture

For MAMP users, I was able to resolve it using this:

The MySQL server of MAMP (not PRO) will be started without any my.cnf file. But you can create your own my.cnf file.

Stop servers
Create a "my.cnf" file in "/Applications/MAMP/conf/".
Add your content in to "my.cnf"
Save "my.cnf"
Start servers

You do not have to put a complete configuration in the my.cnf file. You can just add parts of a configuration ... for example:

[mysqld]
max_allowed_packet = 64M
petergus’s picture

Thank you @opp67
#42 is the answer

ryanissamson’s picture

#42 solved it for me as well, thanks opp67

priyankprajapati’s picture

where i add this patch file ??

in which directory i add this patch ?
give me directory location to add this patch file.

i have using windows 7. so can u explain in biff ??

please help me its urgent..

MastaP’s picture

MastaP’s picture

Edwin Mashayo’s picture

From this discussion, it seems that configuring the my.cnf or my.ini works perfectly on XAMPP/MAMP/LAMP/ etc.
How about on cPanel(Linux)? What is the location of my.cnf or my.ini?

gpantikidis’s picture

#42 solved it for me as well, thank you very much opp67!

klidifia’s picture

So many comments refer to changing max_allowed_packet, which is probably what the issue is, but this could be a bit ambiguous: You may want to change it under [mysqld] instead of (or as well as) [mysqldump] where it may also appear.

Anyway doing that solved the error for me when I was trying to store large amounts of data by extracting text from documents using apachesolr_attachments. I had it on 1M changed to 16M.

najdrupal’s picture

I'm using XAMPP.

I got 2 errors:

1) ERROR 1118 (42000) at line 1807: Row size too large (> 8126). Changing some columns to TEXT or BLOB or using ROW_FORMAT=DYNAMIC or ROW_FORMAT=COMPRESSED may help. In current row format, BLOB prefix of 768 bytes is stored inline.

2) Handling error 2006: MySQL server has gone away

To fix open xampp/mysql/bin/my.ini and under [mysqld]

a) find 'innodb_log_file_size' and change value to innodb_log_file_size=256M - This fixed error 1)
b) find 'max_allowed_packet' and change value from 1M to 16M : max_allowed_packet=16M - This fixed error 2) As per bryancasler #5 above
Note: 'max_allowed_packet' occurs twice in the my.ini file - make sure you only edit the one under [mysqld].

Save
Restart MYSQL via XAMPP control panel

Worked for me, hope it works for you.

hassebasse’s picture

Linux / Debian

For anyone like me using Linux / Debian #42 helped me as well. I changed the settings in etc/mysql/my.cnf from 1MB to 64MB.

I based that on these articles:

https://dev.mysql.com/doc/refman/5.5/en/packet-too-large.html
http://stackoverflow.com/questions/8062496/how-to-change-max-allowed-pac...

Hans

BassPlaya’s picture

#42 helped me too so far.

Divit’s picture

#42 worked for me! Thanks!

gsmwe’s picture

There might be possibilities that you have any malicious file in your public_html/root_directory folder.
Check your 80 port located in cPanel dashboard weither it is blocked.
If it is, then there is error given that which file has malicious program/code just remove this file and press unblock your 80 port.

I found this problem in my sites running on Hostgator.

sites/all/modules/fontawesome/drush/fontawesome.drush.inc

I deleted fontawesome.drush.inc file and it works for me.

That solve my problem today ..

Hope this will help ...