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?

  • 6
    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, 2013 at 23:14
  • 2
    Yeah, that PDO error on a cache related query == problem with max_allowed_packet.
    – mpdonadio
    Jan 14, 2013 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, 2013 at 1:25

1 Answer 1


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.

  • 1
    You could also run net stop mysql, paused 15 seconds, and net start mysql in the event you can't restart the Windows server. Jan 17, 2013 at 17:09

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