Drupal Answers is a question and answer site for Drupal developers and administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Logging as Admin user on Drupal 7 website stored on an IIS machine, I get the following error:

Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE[HY000]: 
General error: 2006 MySQL server has gone away' 
in E:\inetpub\wwwroot\teams\includes\database\database.inc:2139  
Stack trace: 
#0 E:\inetpub\wwwroot\teams\includes\database\database.inc(2139): PDOStatement->execute(Array)
#1     E:\inetpub\wwwroot\teams\includes\database\database.inc(664): DatabaseStatementBase->execute(Array, Array) 
#2 E:\inetpub\wwwroot\teams\includes\database\database.inc(2318): DatabaseConnection->query('SELECT expire, ...', Array, Array) 
#3 E:\inetpub\wwwroot\teams\includes\lock.inc(167): db_query('SELECT expire, ...', Array) 
#4 E:\inetpub\wwwroot\teams\includes\lock.inc(146): lock_may_be_available('schema:runtime:...') 
#5 E:\inetpub\wwwroot\teams\includes\bootstrap.inc(420): lock_acquire('schema:runtime:...') 
#6 E:\inetpub\wwwroot\teams\includes\bootstrap.inc(442): DrupalCacheArray->set(Array) 
#7 [internal function]: DrupalCacheArray->__destruct() 
#8 {main} thrown inE:\inetpub\wwwroot\teams\includes\database\database.inc on line 2139

Any idea on how do I debug those statements? And how do I release locks?

share|improve this question
I'd be 99.999% certain it's for the same reason as this: drupal.stackexchange.com/questions/32642/…. Since this is IIS I'm not totally sure though. I think the config file is my.ini (not my.cnf) under Windows, again not sure – Clive Jan 14 '13 at 23:14
Yeah, that PDO error on a cache related query == problem with max_allowed_packet. – MPD Jan 14 '13 at 23:30
Yes @clive, it was for the same reason. The only difference was that we needed to boot the machine after changing the parameters – Druvision Jan 16 '13 at 1:25
up vote 6 down vote accepted

Indeed, setting maximum allowed packet size in MySQL worked like charm. To solve, we've went to the [mysqld] section of my.ini and added the following:


then restarted the Windows server machine in order to restart MySQL.

The only difference in IIS is that the machine required a boot.

share|improve this answer
You could also run net stop mysql, paused 15 seconds, and net start mysql in the event you can't restart the Windows server. – RolandoMySQLDBA Jan 17 '13 at 17:09

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.