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

---

# Error establishing a database connection

 *  [mehulgarg12](https://wordpress.org/support/users/mehulgarg12/)
 * (@mehulgarg12)
 * [12 years ago](https://wordpress.org/support/topic/error-establishing-a-database-connection-587/)
 * I have installed the wordpress to my root directory.
    However the config file
   is not created and very time i try to create the config file i get the error :
 * 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?
 * I have already checked if the database are not working using the cpanel.
    [http://gargs.co.in/wp-admin/setup-config.php?step=2](http://gargs.co.in/wp-admin/setup-config.php?step=2)
   MY CONFIG FILE UPLOADED TO THE ROOT FOLDER – PUBLIC_HTML
 *     ```
       // ** MySQL settings - You can get this info from your web host ** //
       /** The name of the database for WordPress */
       define('DB_NAME', 'gargs7ic_wpuser');
   
       /** MySQL database username */
       define('DB_USER', <em>[redacted]</em>);
   
       /** MySQL database password */
       define('DB_PASSWORD', <em>[redacted]</em>);
   
       /** MySQL hostname */
       define('DB_HOST', 'localhost');
   
       /** Database Charset to use in creating database tables. */
       define('DB_CHARSET', 'utf8');
       ```
   
 * I am stumped at this for quite a lot of time now. Please help

Viewing 3 replies - 1 through 3 (of 3 total)

 *  [esmi](https://wordpress.org/support/users/esmi/)
 * (@esmi)
 * [12 years ago](https://wordpress.org/support/topic/error-establishing-a-database-connection-587/#post-5023913)
 * Change your database username and password **now**! Never, ever, post sensitive
   information like that in a public forum. You just gave the whole works access
   to your database.
 *  Thread Starter [mehulgarg12](https://wordpress.org/support/users/mehulgarg12/)
 * (@mehulgarg12)
 * [12 years ago](https://wordpress.org/support/topic/error-establishing-a-database-connection-587/#post-5023922)
 * esmi the values i have provided are for an obsolete database.
    thank you for 
   he direction though.
 *  [esmi](https://wordpress.org/support/users/esmi/)
 * (@esmi)
 * [12 years ago](https://wordpress.org/support/topic/error-establishing-a-database-connection-587/#post-5023923)
 * Try checking your database credentials with your hosts.

Viewing 3 replies - 1 through 3 (of 3 total)

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

## Tags

 * [connection](https://wordpress.org/support/topic-tag/connection/)
 * [database](https://wordpress.org/support/topic-tag/database/)
 * [installation](https://wordpress.org/support/topic-tag/installation/)

 * In: [Installing WordPress](https://wordpress.org/support/forum/installation/)
 * 3 replies
 * 2 participants
 * Last reply from: [esmi](https://wordpress.org/support/users/esmi/)
 * Last activity: [12 years ago](https://wordpress.org/support/topic/error-establishing-a-database-connection-587/#post-5023923)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
