Drupal site off-line: connection refused

drupaldrupal-6

I've got a local Drupal 6 instance that was working just fine yesterday. Today, though, I try to visit my site, let's call it http://testsite.local. On every page, including http://testsite.local/user, I get this error:

Site off-line The site is currently
not available due to technical
problems. Please try again later.
Thank you for your understanding.

If you are the maintainer of this
site, please check your database
settings in the settings.php file and
ensure that your hosting provider's
database server is running. For more
help, see the handbook, or contact
your hosting provider.

Note that there is no MySQL error, here. There is only one page I can find that does not have this error: http://testsite.local/install.php. That page does include an error message on it:

Failed to connect to your MySQL database server. MySQL reports the following message: Connection refused.

  • Are you sure you have the correct username and password?
  • Are you sure that you have typed the correct database hostname?
  • Are you sure that the database server is running?

For more help, see the Installation and upgrading handbook. If you are unsure what these terms mean you should probably contact your hosting provider.

However, my other local site is running just fine off the same database, and I can connect to the database using the command line. I'm pretty sure I have the correct permissions, as well, since things were working in the past:

$ mysql --host=localhost --user=testuser --password=testpassword testdb
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 19
Server version: 5.5.11-log Source distribution

Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> SHOW GRANTS FOR CURRENT_USER();
+-------------------------------------------------------------------------------------------------------------------------------------+
| Grants for testuser@localhost                                                                                                       |
+-------------------------------------------------------------------------------------------------------------------------------------+
| GRANT USAGE ON *.* TO 'testuser'@'localhost' IDENTIFIED BY PASSWORD 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'                     |
| GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, INDEX, ALTER, LOCK TABLES ON `testdb`.* TO 'testuser'@'localhost'               |
+-------------------------------------------------------------------------------------------------------------------------------------+
2 rows in set (0.03 sec)

My settings.php uses the same credentials:

$db_url = 'mysqli://testuser:testpassword@localhost/testdb';

I can't figure out what's wrong. Please help!

Best Answer

You need to double-check that your server is really using this settings.php file.

You can use find or locate if you are working in Linux environment.

You can also try to rename/move the config file to another location and see if the error message changes.

This type of error is most likely a misconfiguration.

Related Topic