I had an error (related to Date module I think? Can't remember.) on my site so I tried to do an update. Caused a WSOD so I svn reverted. Didn't help. Manually disabled each module in the database. Didn't help. Fixed some permissions. Helped... sort of.

Now I get this:

Drupal already installed To start over, you must empty your existing database. To install to a different database, edit the appropriate settings.php file in the sites folder. To upgrade an existing installation, proceed to the update script. View your existing site.

Running the upgrade script gives this error:

PDOException: SQLSTATE[HY000] [2002] Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2) in drupal_get_installed_schema_version() (line 150 of /public_html/includes/install.inc).

Any other page redirects back to install.php.

So it seems like it can see the database to know that it's not empty, but can't really connect to it... what does this mean? What do I do about it.

closed as off-topic by kiamlaluno Oct 14 '15 at 10:42

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "This question was caused by a problem that can no longer be reproduced, was solved by a cache clear, or was a simple typographical error. While similar questions may be on-topic here, this one was resolved in a manner unlikely to help future readers." – kiamlaluno
If this question can be reworded to fit the rules in the help center, please edit the question.

  • Sounds very much like the MySQL server isn't running. Can you connect to the database outside of Drupal (eg with phpmyadmin)? – Clive Aug 4 '12 at 11:22
  • Yes, I can connect with phpmyadmin. – beth Aug 4 '12 at 11:31
  • What about locally from the command line using mysql? – mpdonadio Aug 4 '12 at 16:35

I figured this out. It's able to see the settings.php file but instead of the right database credentials it was showing this:

$db_url = 'mysqli://mynamedrupal:xxxxxxxxxxx@localhost/myname-drupal-6';

That's goofy! I'm not even using Drupal 6! There wasn't any updated version of this later in the file; this was the only database connection info. It makes sense that this was in here, since it was originally a D6 site that I upgraded, but it's unusual that it worked so long without an updated array of DB connection info.

So I pasted this in from another D7 install and changed the un/pw accordingly:

$databases = array (
  'default' =>
  array (
    'default' =>
    array (
      'database' => 'myname-drupal',
      'username' => 'myname',
      'password' => 'xxxxxxxxx',
      'host' => 'server.host.com',
      'port' => '',
      'driver' => 'mysql',
      'prefix' => '',

I can't say for sure if this works because now I'm having different, unrelated problems. But I think this solved this particular issue, as far as I can tell, and now I'm on to troubleshooting the next thing. w00t.

  • I think the reason this happened is that SVN vomited on my web folder in such a way that my settings.php file somehow got reverted to a much, much earlier version. Like, years earlier. The moral of this story is to avoid SVN at all costs. – beth Aug 4 '12 at 19:47

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