Optimize and Repair Corrupt MYSQL Databases
mysqlcheck -uUSER -p --auto-repair --check --optimize --all-databases
Note: The code will check > repair > optimize all the databases under the given USER.
While playing with multiple cache plugins and memcached, don’t know how, but my wordpress database got corrupted. I noticed the error next day while submission of a post. After noticing the “Error Establishing Database” error, I immediately opened my wp-config.php file to verify the db details, they were correct. Since I didn’t the file them for a long time, I was positive. Then, I logged in to my ssh and checked if the mysql daemon process running. It was running.
At last, I checked all the database tables through ssh and found wp_options table was corrupt. Finally, atleast found the culprit. I then issued the command to optimize and repair the table and yay! my website is alive again.