Title: Database error
Last modified: August 31, 2016

---

# Database error

 *  [eludlow](https://wordpress.org/support/users/eludlow/)
 * (@eludlow)
 * [10 years ago](https://wordpress.org/support/topic/database-error-216/)
 * I’m moving a WP installation from a development server to a soon-to-be-live server.
   I’ve moved the installation, but am getting the basic “
    Error establishing a
   database connection” error. However, a simple php script in the same directory
   as wp-config.php, with exactly the same details for the connection, can connect
   fine and query the selected DB no problem. I’m really confused by this!
 * Any pointers to what I should be checking?
 * Thanks,
    Ed

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

 *  Moderator [Steven Stern (sterndata)](https://wordpress.org/support/users/sterndata/)
 * (@sterndata)
 * Volunteer Forum Moderator
 * [10 years ago](https://wordpress.org/support/topic/database-error-216/#post-7343064)
 * Often, it’s invisible characters that mess things up.
 * Use this script to get a finer-grained error message:
 * [https://gist.github.com/sivel/162913](https://gist.github.com/sivel/162913)
 * As there are only 4 parameters, you can also manually retype them in wp-config.
   php
 *  Moderator [t-p](https://wordpress.org/support/users/t-p/)
 * (@t-p)
 * [10 years ago](https://wordpress.org/support/topic/database-error-216/#post-7343066)
 * Also, try reviewing the following codex for possible reasons and solutions: [http://codex.wordpress.org/Common_WordPress_Errors#Error_Establishing_Database_Connection](http://codex.wordpress.org/Common_WordPress_Errors#Error_Establishing_Database_Connection)
 *  Thread Starter [eludlow](https://wordpress.org/support/users/eludlow/)
 * (@eludlow)
 * [10 years ago](https://wordpress.org/support/topic/database-error-216/#post-7343068)
 * Thanks both. [@sterndata](https://wordpress.org/support/users/sterndata/), I’ve
   run that and it connects fine all tables are ok…
 * Will work my way through the codex again…:(
 *  Thread Starter [eludlow](https://wordpress.org/support/users/eludlow/)
 * (@eludlow)
 * [10 years ago](https://wordpress.org/support/topic/database-error-216/#post-7343123)
 * A ltitle update on this. If I intentionally use incorrect mySQL user details 
   in my wp-config.php, I get the following (nicely formatted!) message:
 * > Warning: mysql_connect(): Access denied for user ‘root’@’localhost’ (using 
   > password: YES) in /var/www/pssru/public_html/wordpress/wp-includes/wp-db.php
   > on line 1482
   > 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.
 * However, with the correct details, I get the very plain (Times New Roman):
 * > Error establishing a database connection

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

The topic ‘Database error’ is closed to new replies.

## Tags

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

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 4 replies
 * 3 participants
 * Last reply from: [eludlow](https://wordpress.org/support/users/eludlow/)
 * Last activity: [10 years ago](https://wordpress.org/support/topic/database-error-216/#post-7343123)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
