Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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!

share|improve this question
    
The "Connection refused" error means the port you are accessing is not open on this machine. You need to double-check your configuration. Sometimes, you get this type of strange errors by editing another unused config file. Maybe, you need also to check your manual for setup and maintenance steps. –  Khaled May 13 '11 at 19:38
    
@Khaled Specifying port 3306 explicitly on the command line still works, but explicitly placing the port in the settings.php still gives me no improvement. –  arussell84 May 13 '11 at 19:45
1  
@arussell84: I don't know much about Drupal, but I have to ask: Did you do some service restart/reload after changing the configuration file. To check that you are really changing the right config file, you can try to rename the file and/or move it to another path and see if you get a different error. –  Khaled May 13 '11 at 19:50
    
@Khaled Usually no service restart or reload is necessary after editing settings.php. Interestingly enough, though, nothing changes if I move the config files. It's as if my site doesn't know they exist in the first place, then. –  arussell84 May 13 '11 at 20:02
1  
Try to search for other files named settings.php and do the same thing of rename/move. If you are on Linux platform, you can try find or locate. –  Khaled May 13 '11 at 20:06
show 3 more comments

3 Answers

up vote 1 down vote accepted

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.

share|improve this answer
add comment

Check under the sites directory. A common cause of this can be a directory structure that's supposed to look like:

sites/
      default/
              settings.php
      somedomain.com -> default

But that got checked into a braindead SCCS (and out and back in via a braindead client) such that it treated the symlink as another directory, so now you have:

sites/
      default/
              settings.php
      somedomain.com/
              settings.php

And, of course, you're probably only changing default/settings.php, since that's the only reasonable one to be changing when you're not running multisite. That said, the real solution here is not to fix the other settings.php or to repair the symlink, but instead to simply delete "somedomain.com"; it's not adding anything to your configuration.

One other way I've seen this happen: a very, very large (500 lines or so) settings.php actually had two $db_urls in it. The second one, of course, "won". Talk about things you don't think to look for!

share|improve this answer
add comment

try: 'mysqladmin flush-hosts’. Also check your mysql user perms. Maybe your not allowing access to that db? Also check the firewalss between those servers.

share|improve this answer
    
Edited my question with my privileges. I ran mysqladmin --user=root flush-hosts with no luck, as well. The servers are both on my localhost, and no firewalls between them. –  arussell84 May 13 '11 at 19:38
    
You know what you might try, is just throwing your credentials into the settings.php folder and try going to the site. See what happens then. If you get the same error; we can continue to try new things. If you get an error that states something like drupal isn't installed, then we are doing well. –  lilott8 May 13 '11 at 20:01
    
My credentials already were in the settings.php file, as I stated toward the end of my original question. Or maybe I'm misunderstanding you? –  arussell84 May 13 '11 at 21:29
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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