Title: Database Connection Error
Last modified: August 21, 2016

---

# Database Connection Error

 *  Resolved [jparnell8839](https://wordpress.org/support/users/jparnell8839/)
 * (@jparnell8839)
 * [12 years, 5 months ago](https://wordpress.org/support/topic/database-connection-error-28/)
 * Ok, so after about 20 minutes of Googling, and not finding anything, and finally
   fixing it myself, I decided to post here for the benefit of future Googlers.
 * I have my WordPress site and I decided to migrate it to a local xampp host to
   do all my testing so as not to interrupt service. Exported my database with phpMyAdmin.
   I edited all entries in my database from [http://domain.com](http://domain.com)
   to [http://localhost/domain.com](http://localhost/domain.com) to maintain everything.
   Created a new database and new user with the same name, imported, copied all 
   files from FTP to my xampp htdocs folder, and voila! I thought I was golden.
 * I was not. Upon restarting Apache2/MySQL, I discovered that I was getting the
   infamous Database Connection Error. Looked at my wp-config.php (and like most
   people/hosting providers, I dont have a dedicated MySQL database server, so it
   was localhost), everything matched. Tried the OLD_PASSWORD trick, didn’t work.
   Was at a loss on what to do.
 * I wont go into everything I did to troubleshoot, but the short and sweet of it
   was this:
 * When creating your user in your xampp phpMyAdmin, do not create it using Any 
   Host (as you will be ‘useer’@’%’). That will result in the database connection
   error. When selecting the host in phpMyAdmin while creating a user, select Local(
   for localhost, i.e. ‘user’@’localhost’).
 * Hope this helps someone.

Viewing 1 replies (of 1 total)

 *  [Val](https://wordpress.org/support/users/vlbooth/)
 * (@vlbooth)
 * [12 years, 5 months ago](https://wordpress.org/support/topic/database-connection-error-28/#post-4405823)
 * Thank you for sharing.

Viewing 1 replies (of 1 total)

The topic ‘Database Connection Error’ is closed to new replies.

## Tags

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

 * In: [Localhost Installs](https://wordpress.org/support/forum/localhost-installs/)
 * 1 reply
 * 2 participants
 * Last reply from: [Val](https://wordpress.org/support/users/vlbooth/)
 * Last activity: [12 years, 5 months ago](https://wordpress.org/support/topic/database-connection-error-28/#post-4405823)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
