There are numerous reasons that may prevent you from connecting to your database.
The database may not exist. If you are unsure, then you may need to ask your Web Host for information on your MySQL database.
Your configuration file may have erroneous information. This is the most common mistake when configuring WordPress.
You may be missing a necessary user prefix. If so in the wp-config.php file modify the “DB_NAME” constant to “yourloginname_wp”, or modify “DB_USER” with “yourloginname_dbuser”.
Check that there is no whitespace at the bottom of your wp-config.php file.
Also, check your WordPress configuration values have been set correctly.
Thanks for your reply. I’m so confused has to how this happened. My site was working fine the other day, and I changed my password while I was logged in. How can I check the code if I’m not able to log in?
You can access your wp-config.php file through an FTP client like FireFTP or Cyberduck, or through your webhost’s cpanel interface.
I just set up a new WP site yesterday, got it all designed/configured, and received this message this AM. When I opened my wp-config.php file it did, indeed, have an extra empty line of code at the end. I deleted it with my text editor and now the site is back up.
Weird, I know. But it worked.
P.S. Speaking from experience, ALWAYS back up or compress a copy of any file you are going to mess with. Good luck!
I have downloaded my db file from my host to Localhost and every time that I try to access it I get the error message “error establishing a database connection” However,
If I access the original “http://localhost/wordpress” I get a perfect WordPress site
Both DB’s are in the same Htdocs, is this a problem?