Community & Support

Warning: MySQL server has gone away query

The query was performed and the data updated; however, the next screen shows the site is offline and this error message after saving the Drupal form to create a new page. Is this a problem with our web host server or our Drupal /includes/ files?

This is an example from adding a content_type; however, the site is offline page displays after almost any form submission.

Warning: MySQL server has gone away query: INSERT INTO watchdog (uid, type, message, variables, severity, link, location, referer, hostname, timestamp) VALUES (1, 'php', '%message in %file on line %line.', 'a:4:{s:6:\"%error\";s:12:\"user warning\";s:8:\"%message\";s:98:\"MySQL server has gone away\nquery: SELECT comment_count FROM node_comment_statistics WHERE nid = 43\";s:5:\"%file\";s:78:\"/path/to/modules/comment/comment.module\";s:5:\"%line\";i:1122;}', 3, '', 'http://xxx.org/resources/weblinks', 'http://xxx.org/node/add/weblinks', '71.52.65.47', 1283446451) in /path/to/includes/database.mysql.inc on line 128

Drupal 6.17

Recent changes: updated Token 6.x-1.14 and Path Auto 6.x-2.0-alpha2

Comments

This message means the PHP

This message means the PHP code for Drupal running in your webserver process cannot contact the specified MySQL server, after having been able to do so at some point. Usually it means MySQL crashed or was restarted (thus losing open connections), or that the network connectivity between your webserver and the MySQL server was broken.

Without knowing more about your particular installation, it would be hard to provide more details about the MySQL connection question.

It is possible, although less likely, that instead some data got corrupted on the webserver side of things in such a way as to produce this message. Generally webserver, authentication and Drupal code problems would produce different error messages.

Thank you for that easy to understand explanation. My web host's support service used to be the best in the world; now it is horrible. The more information I can gather, the better I can deal with them.

_____________________________
Pay It Forward at Drupal
When you ask a Forum question, look for one you can answer.

Grant privileges on database

I saw this post about another issue that was close: http://drupal.org/node/295561

There was a suggestion to re-grant the privileges on the SQL database to solve that problem. I decided to try it for my problem. Still some errors, but I can view the site.

Update after a few minutes: Nope. Let me view 2-3 clicks and then it cannot connect to the Server. The re-grant privileges solution did not work.

_____________________________
Pay It Forward at Drupal
When you ask a Forum question, look for one you can answer.

It sounds like your query is

It sounds like your query is killing mysql. Does the database go away for about 5-10 minutes and then come back? If so, that probably means mysql is dying and rebooting. It will take a few minutes to start up again while it checks the tables for corruption. You may have a corrupt database table or two. They usually aren't a big deal, but sometimes they can give mysql hell. If you have root access to the machine, go into /var/lib/mysql/{your database here} and try running myisamchk http://dev.mysql.com/doc/refman/5.0/en/myisamchk.html or whatever the equivalent is for innodb (depending on your tables). Another option is to run the sql statement CHECK TABLE table_name on all your tables http://dev.mysql.com/doc/refman/5.0/en/check-table.html and run REPAIR TABLE on the broken ones. I think there's even a database maintenance module that will do that for you.

Oh, and back your database up

Oh, and back your database up before doing that. Sometimes the repairs don't go smoothly and you'll absolutely need to be able to roll back to where you were before you started to continue. So not only should you back it up, but you should push into another database and make sure the backup you just made is working properly.

re: mysql is dying and rebooting

The behaviour you described is how our web site frequently operates. After submitting a form the web site stalls, sometimes displaying a Server Not Found error message. I often have to re-enter the Home page URL in the browser to get the site back on screen.

Thanks for the suggestion to check the tables (and to make a backup first). I copied the Tables and Data to a separate database and used phpMyAdmin to Check Tables on the copied database. All tables reported as OK.

Perhaps all my messages finally got through to the right ThinkHost support tech. There is a notice at ThinkHost that they are working on the server where our files are stored.

_____________________________
Pay It Forward at Drupal
When you ask a Forum question, look for one you can answer.

+1 for this solution

I was having a similar problem but increasing my memory size helped me

Website Administrator
Syracuse City School District
SyracuseCitySchool.com

Same Problem

I was using the devel module and working with preprocessor functions. I'm working with the garland theme. I changed this:
function phptemplate_preprocess_page(&$vars)

to

function garland_preprocess_page(&$vars)

and that solved the problem.

nobody click here