I'm hoping someone can point me to a fix. My drupal 7 app was running fine locally this a.m. while I was testing a way to insert a row using mysql tools for a non-Drupal function. My environment is Apache running virtual host on php 5.4.34 on a Ubuntu VM.
After not getting satisfaction using the mysql functions, I started a simple PDO function using Drupal's database settings from the settings.php file. I was able to insert a row successfully but when I returned to the local site I got this error after a long time:
drupal_log_error(Array ([%type] => PDOException,[!message] => SQLSTATE[HY000]  Connection timed out,[%function] => lock_may_be_available(),[%file] => /media/psf/Home/apps/habitatnashville/includes/lock.inc,[%line] => 167, etc [%type] => PDOException [!message] => SQLSTATE[HY000]  Connection timed out [%function] => lock_may_be_available() [%file] => /media/psf/Home/apps/habitatnashville/includes/lock.inc [%line] => 167 [severity_level] => 3
I've looked here and on Drupal's site. Because it's a connection error the likely suspects are that I've munged the credentials somehow.
When something like this happened months ago, I did a service mysql restart, did that again a few minutes ago, rebooted the ubuntu VM and rebooted entire computer to shake that lock.
I've removed that test file with the PDO just in case. Here's the output of my drush status:
Drupal version : 7.27 Site URI : http://default Database driver : mysql Database username : admin Database name : my_db Database : Connected Drupal bootstrap : Successful Drupal user : Anonymous Default theme : My_theme Administration theme : rubik PHP executable : /home/sam/.phpbrew/php/php-5.4.34/bin/php PHP configuration : /home/sam/.phpbrew/php/php-5.4.34/etc/php.i ni PHP OS : Linux Drush version : 6.2.0
My database is running as "service mysql status" => mysql: start/running, process 1291. What else could be affecting this?