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

---

# Error establishing a database connection

 *  [shashanknaphade](https://wordpress.org/support/users/shashanknaphade/)
 * (@shashanknaphade)
 * [15 years ago](https://wordpress.org/support/topic/error-establishing-a-database-connection-289/)
 * Hello all.
 * I have done following settings in wp-config.php
    define(‘DB_NAME’, ‘wordpress’);
 * /** MySQL database username */
    define(‘DB_USER’, ‘root’);
 * /** MySQL database password */
    define(‘DB_PASSWORD’, ‘ ‘);
 * /** MySQL hostname */
    define(‘DB_HOST’, ‘localhost’);
 * /** Database Charset to use in creating database tables. */
    define(‘DB_CHARSET’,‘
   utf8’);
 * /** The Database Collate type. Don’t change this if in doubt. */
    define(‘DB_COLLATE’,”);
 * I have also made a database named wordpress in phpmyadmin
    But i am not able 
   to run on localhost and getting error
 * Thank you in advance

Viewing 1 replies (of 1 total)

 *  Moderator [t-p](https://wordpress.org/support/users/t-p/)
 * (@t-p)
 * [15 years ago](https://wordpress.org/support/topic/error-establishing-a-database-connection-289/#post-2143585)
 * > i am not able to run on localhost and getting error
 * [http://codex.wordpress.org/User:BryanVillarin/Locally_installing_WP](http://codex.wordpress.org/User:BryanVillarin/Locally_installing_WP)
   
   [http://codex.wordpress.org/Installing_WordPress#Installing_WordPress_on_your_own_Computer](http://codex.wordpress.org/Installing_WordPress#Installing_WordPress_on_your_own_Computer)
 * > Error establishing a database connection
 * – double check your wp-config.php file settings for the database name, database
   username and database password. **This is where most errors occur. **-Then check
   that you don’t need to change the database host from “localhost” to something
   else. You can get that info from your hosting provider.
    -Check you have actually
   created a database with the same database name as is in your wp-config.php file.-
   Last, but not least, if all that information is correct your database probably
   has a problem with it, and you may need to contact your hosting provider. There
   are also many threads on this topic on these forums: [http://wordpress.org/search/Error+establishing+a+database+connection?forums=1](http://wordpress.org/search/Error+establishing+a+database+connection?forums=1)
   Also, see if this video helps: [http://educhalk.org/blog/2009/03/error-establishing-a-database-connection-how-to-fix-this-wordpress-error/](http://educhalk.org/blog/2009/03/error-establishing-a-database-connection-how-to-fix-this-wordpress-error/)

Viewing 1 replies (of 1 total)

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

## Tags

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

 * In: [Installing WordPress](https://wordpress.org/support/forum/installation/)
 * 1 reply
 * 2 participants
 * Last reply from: [t-p](https://wordpress.org/support/users/t-p/)
 * Last activity: [15 years ago](https://wordpress.org/support/topic/error-establishing-a-database-connection-289/#post-2143585)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
