Title: Error establishing a database connection
Last modified: August 19, 2016

---

# Error establishing a database connection

 *  [yasharino](https://wordpress.org/support/users/yasharino/)
 * (@yasharino)
 * [15 years, 6 months ago](https://wordpress.org/support/topic/error-establishing-a-database-connection-252/)
 * Error establishing a database connection
 * This either means that the username and password information in your wp-config.
   php file is incorrect or we can’t contact the database server at localhost. This
   could mean your host’s database server is down.
 *  * Are you sure you have the correct username and password?
    * Are you sure that
   you have typed the correct hostname? * Are you sure that the database server 
   is running?
 * If you’re unsure what these terms mean you should probably contact your host.
   If you still need help you can always visit the WordPress Support Forums.
 * ———-
 * I checked the username and password and database name but nothing was wrong about
   them….
    what should i do?

Viewing 15 replies - 1 through 15 (of 17 total)

1 [2](https://wordpress.org/support/topic/error-establishing-a-database-connection-252/page/2/?output_format=md)
[→](https://wordpress.org/support/topic/error-establishing-a-database-connection-252/page/2/?output_format=md)

 *  [govpatel](https://wordpress.org/support/users/govpatel/)
 * (@govpatel)
 * [15 years, 6 months ago](https://wordpress.org/support/topic/error-establishing-a-database-connection-252/#post-1770610)
 * contact your host and ask them if they use localhost or a some other connection
   to database as some host do not use localhost.
 *  [chrisps](https://wordpress.org/support/users/chrisps/)
 * (@chrisps)
 * [15 years, 6 months ago](https://wordpress.org/support/topic/error-establishing-a-database-connection-252/#post-1770870)
 * Yasharino. Did you fix the issue? I had the same problem, or at least the same
   error as you did. My problem is that I didn’t put the database before the username,
   like mydatabase_username. I only put the username. Hope you get it fixed!
 *  [Phil Marnell](https://wordpress.org/support/users/entrepreblog/)
 * (@entrepreblog)
 * [15 years, 6 months ago](https://wordpress.org/support/topic/error-establishing-a-database-connection-252/#post-1770871)
 * Amazing.
 * See this thread:
 * [http://wordpress.org/support/topic/11-problems-wordpress-not-connecting-to-database?replies=11](http://wordpress.org/support/topic/11-problems-wordpress-not-connecting-to-database?replies=11)
 *  Thread Starter [yasharino](https://wordpress.org/support/users/yasharino/)
 * (@yasharino)
 * [15 years, 6 months ago](https://wordpress.org/support/topic/error-establishing-a-database-connection-252/#post-1770872)
 * I fixed it by changing the SQL name from”localhost” to the one that The host 
   panel gave me.
    the name is like sq.domainnam.com
 *  [Phil Marnell](https://wordpress.org/support/users/entrepreblog/)
 * (@entrepreblog)
 * [15 years, 6 months ago](https://wordpress.org/support/topic/error-establishing-a-database-connection-252/#post-1770873)
 * fc999999.axxxxxxx.net is the hostname in the console.
 * i made the explicit change – it still doesn’t work.
 * but, thanks for the idea.
 *  Thread Starter [yasharino](https://wordpress.org/support/users/yasharino/)
 * (@yasharino)
 * [15 years, 6 months ago](https://wordpress.org/support/topic/error-establishing-a-database-connection-252/#post-1770875)
 * I just went to the database management section and copy the address of the MYSQL
   database that I have had created it for installation. then pasted it to config
   file with username and password needed.
 *  [govpatel](https://wordpress.org/support/users/govpatel/)
 * (@govpatel)
 * [15 years, 6 months ago](https://wordpress.org/support/topic/error-establishing-a-database-connection-252/#post-1770877)
 * That is common mistake lot of people make as not all host use localhost and wordpress
   sets that as default so its best to check with the host they will tell you what
   to use.
 *  [Phil Marnell](https://wordpress.org/support/users/entrepreblog/)
 * (@entrepreblog)
 * [15 years, 6 months ago](https://wordpress.org/support/topic/error-establishing-a-database-connection-252/#post-1770878)
 * but this doesn’t work even using the explicit hostname from the console.
 *  [govpatel](https://wordpress.org/support/users/govpatel/)
 * (@govpatel)
 * [15 years, 6 months ago](https://wordpress.org/support/topic/error-establishing-a-database-connection-252/#post-1770879)
 * [@entrepreblog](https://wordpress.org/support/users/entrepreblog/) have you checked
   with your host why you can not connect to database.
 *  [Phil Marnell](https://wordpress.org/support/users/entrepreblog/)
 * (@entrepreblog)
 * [15 years, 6 months ago](https://wordpress.org/support/topic/error-establishing-a-database-connection-252/#post-1770880)
 * [@govpatel](https://wordpress.org/support/users/govpatel/), i _am_ the host: 
   it’s a caged server, it’s running many apps, including another insulated wp instance;
   and i have many other wp instances running on other hosts – dedicated and otherwise.
 * native commandline mysql works fine with the credentials in teh wp-config.php
   file. i’ve tailed the usual suspect log files and don’t see anything from the
   wp failure to connect.
 * there is nothing in the host side to indicate why my results are the same as 
   this:
 * [http://tabletennisetc.co.uk/tabletennis/wp-admin/install.php](http://tabletennisetc.co.uk/tabletennis/wp-admin/install.php)
 * there are 2 other threads open here with individuals having exactly the same 
   problem.
 * thanks.
 *  [Phil Marnell](https://wordpress.org/support/users/entrepreblog/)
 * (@entrepreblog)
 * [15 years, 6 months ago](https://wordpress.org/support/topic/error-establishing-a-database-connection-252/#post-1770883)
 * [@govpatel](https://wordpress.org/support/users/govpatel/), do you know where
   the debug output is recorded in wordpress?
 *  [Phil Marnell](https://wordpress.org/support/users/entrepreblog/)
 * (@entrepreblog)
 * [15 years, 6 months ago](https://wordpress.org/support/topic/error-establishing-a-database-connection-252/#post-1770896)
 * Ok.
 * Does A N Y B O D Y know where debug output is recorded in WordPress?
 * If debug is set to true, where is it written?
 *  Moderator [t-p](https://wordpress.org/support/users/t-p/)
 * (@t-p)
 * [15 years, 6 months ago](https://wordpress.org/support/topic/error-establishing-a-database-connection-252/#post-1770897)
 * documentation: [http://codex.wordpress.org/Editing_wp-config.php#Debug](http://codex.wordpress.org/Editing_wp-config.php#Debug)
 *  [Phil Marnell](https://wordpress.org/support/users/entrepreblog/)
 * (@entrepreblog)
 * [15 years, 6 months ago](https://wordpress.org/support/topic/error-establishing-a-database-connection-252/#post-1770908)
 * So, one week later, and level 2 support tries this:
    - Rename ‘wordpress’ directory to ‘wordpressblog’
    - …and it works.
    - Anyone want to weigh in on that?
    - It FIXES the problem. Any ideas why?
 *  [Phil Marnell](https://wordpress.org/support/users/entrepreblog/)
 * (@entrepreblog)
 * [15 years, 6 months ago](https://wordpress.org/support/topic/error-establishing-a-database-connection-252/#post-1770914)
 * I will cross-post this, as it may apply more than one item, but after pulling
   my hair out on this for many, many days I got level 2 support at cari.net involved.
   They were also puzzled, but finally the support person tried something simple:
   he renamed the folder (‘wordpress’) to ‘wordpressblog’.
 * And it instantly began working as advertised.
 * Why? Who knows, and at this point I don’t really care to spend anymore time figuring
   it out.
 * But it might be worth a try.

Viewing 15 replies - 1 through 15 (of 17 total)

1 [2](https://wordpress.org/support/topic/error-establishing-a-database-connection-252/page/2/?output_format=md)
[→](https://wordpress.org/support/topic/error-establishing-a-database-connection-252/page/2/?output_format=md)

The topic ‘Error establishing a database connection’ is closed to new replies.

 * In: [Installing WordPress](https://wordpress.org/support/forum/installation/)
 * 17 replies
 * 6 participants
 * Last reply from: [Phil Marnell](https://wordpress.org/support/users/entrepreblog/)
 * Last activity: [15 years, 6 months ago](https://wordpress.org/support/topic/error-establishing-a-database-connection-252/page/2/#post-1770919)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
