Fatal Error: PDOException: SQLSTATE[42000] [1049] Unknown database I have a development site (site1) and created a second (site2) using drush, copied over all modules/themes and continued development. Both were working and I continued module updates in both.  When I returned to site1, I found an error message as follows: 


  PDOException: SQLSTATE[42000] [1049] Unknown database 'mydevelopmentDB' in lock_may_be_available() (line 167 of mywebsite/includes/lock.inc).


There features and nodes I would like to use in site2 but I cannot access it. So I created a new site (site3) using drush, copied the contributed modules &amp; themes from site2, and imported the database from site1 into site3, only to get the same error message as from site1.

As I interpret this, situation, the core and contributed module files in site3 should be good, the core is a fresh copy and contributed modules are taken from site2, which is working fine. The settings.php files are identical except for the database, username and password settings match the individual database name. The only difference is the database itself.  Can anyone help identify the table(s) that might have a setting that might cause this problem?
This isn't a problem with tables, it's a problem with the name of the database.

Drupal is successfully connecting to your database server, but it isn't finding a database with the name mydevelopmentDB (which must be the name of the database specified in settings.php).

To isolate the problem:


Open up PHPMyAdmin for the server in question and run this query:

SELECT * FROM mydevelopmentDB.users


If you get a similar error then you know that you've definitely got the wrong database name.
Make sure that the name of the database on the server matches the case of the database name in settings.php. Depending on your MySQL settings the server may or may not be enforcing case sensitivity on database/table names.