Database Connection Error
-
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 https://domain.com to https://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.
- The topic ‘Database Connection Error’ is closed to new replies.