Tonight I was trying to "upgrade" our multiple-site installation of Drupal to point to the MySQL database on a different server. I changed the mysqli $db_url in the settings.php file for each site to point to the new server rather than to localhost.

I had tested this earlier by pointing our QA installation of Drupal at the new database server without any insurmountable problems. Tonight, though, Drupal came up on the new database server, but I kept getting intermittent error screens that said Drupal was "unable to select database." The database URL was right, though. I thought it seemed like a cache problem, but I had cleared the cache tables.

What else could cause this error. I had to back out of the database server change.

Comments

scottm316’s picture

Only thing I experienced with the settings.php file, it gets its permissions reset on any page load. So if you thought you changed the permissions of the file to allow yourself to write over it, and someone opened a drupal page, perms may have been reset by drupal, hence not being able to update with the new settings. Make sure your sites are offline...

Might also try a new php file with something like $link = mysql_connect('yourserver:port', 'mysql_user', 'mysql_password'); to see that you can connect, and try selecting a db from there.

If the problem is intermittent though and you have to look outside drupal, what about the number of connections your mysql server is allowed to accept? I think default is 100 and you can up that after the right assessments. Or memory limits on msyql, check the mysql config file and/or memory limits for the mysql user. And of course make sure the server has enough memory.

Sincerely,

Scott Morrison
Scott eSolutions Ltd.
www.scottesolutions.com
Edmonton, AB

Scott
http://morrisonmultimedia.ca/
Edmonton, AB