Title: Error establishing database connection after move
Last modified: August 31, 2016

---

# Error establishing database connection after move

 *  Resolved [actionmedia](https://wordpress.org/support/users/actionmedia/)
 * (@actionmedia)
 * [10 years, 2 months ago](https://wordpress.org/support/topic/error-establishing-database-connection-after-move/)
 * Hello,
 * I have developed a site under domain.com/site. I now want to move it to it’s 
   own cpanel account, which is site.com/~NL
 * I have copied all files over to site.com/~NL. I also exported and imported the
   db.
 * For some reason, it keeps saying “error connecting to db”. I have tried everything
   possible to fix this, and can’t. I even deleted account ~NL from WHM, and recreated
   it. I know the db connection works fine. The db username/password are correct.
   I even tried importing the db via command line (mysql command) and it imports
   fine, but won’t connect when trying to acccess the site via the new site.com/
   ~NL url. Is it possible the site won’t work until I update the DNS of the domain
   name? That shouldn’t matter…
 * Any help is greatly appreciated.

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

 *  Moderator [t-p](https://wordpress.org/support/users/t-p/)
 * (@t-p)
 * [10 years, 2 months ago](https://wordpress.org/support/topic/error-establishing-database-connection-after-move/#post-7422701)
 * “Error establishing a database connection” means that there is a problem with
   the connection to your database and there could be a number of reasons for this.
   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 [actionmedia](https://wordpress.org/support/users/actionmedia/)
 * (@actionmedia)
 * [10 years, 2 months ago](https://wordpress.org/support/topic/error-establishing-database-connection-after-move/#post-7422733)
 * Something really strange is going on.
 * I did a fresh install of WP, and everything works fine. I used db name site_test.
 * I then imported my db from the other site to site_import. I then modified the
   wp-config file to point to the new db and db username, and I get a HTTP 500 error.
 * I went back into wp-config, and put back in the original site_test info, and 
   I still get a HTTP 500 error. I don’t understand what’s going on.
 * Is there an easier way to migrate WP?
 *  Thread Starter [actionmedia](https://wordpress.org/support/users/actionmedia/)
 * (@actionmedia)
 * [10 years, 2 months ago](https://wordpress.org/support/topic/error-establishing-database-connection-after-move/#post-7422811)
 * I used updraft backup/restore and it’s working fine. Really odd.
 *  Moderator [t-p](https://wordpress.org/support/users/t-p/)
 * (@t-p)
 * [10 years, 2 months ago](https://wordpress.org/support/topic/error-establishing-database-connection-after-move/#post-7422855)
 * Glad to know its working fine 🙂

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

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

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 4 replies
 * 2 participants
 * Last reply from: [t-p](https://wordpress.org/support/users/t-p/)
 * Last activity: [10 years, 2 months ago](https://wordpress.org/support/topic/error-establishing-database-connection-after-move/#post-7422855)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
