Issue
I am getting the error: "error establishing a database connection" after moving my wordpress blog to Amazon EC2. I've checked the wp-config.php file and settings are ok (localhost, password and username).
I've read many of the questions and answers here but nothing helped me.
I have shell access so I can check everything that you need me to do. Maybe I should look at the configuration file for phpmyadmin to see what db connection settings are there, because phpmyadmin works, but I don't know where it is.
Thanks
Solution
For me just restarting the mysqld service worked. There was a hitch though, as soon as I executed sudo service mysqld restart
the MySql service stopped but didn't start. sudo services mysqld start
gave a MySQL Deamon Failed to Start Error. I spent a lot of time trying to start the service but I guess the real culprit was the httpd service. I stopped the httpd service sudo service httpd stop
. Now execute sudo service mysqld restart
and bingo the wordpress site was back online(remember to start the httpd service). This sounds kind of lame but it worked, from what I figured out the MySQL DB stops for a number of reasons looking at the log and figuring out the actual reason is the only thing that works for me.
Answered By - Karthik