It is always frustrating when you go to check out your blog and you get a message saying a “database connection” error has occurred rather than your normal website displaying. Most of the times a simple restart of MySQL will fix the problem. Most problems such as this relate to your WordPress database and can be fixed without much difficulty.
Once you have determined that WordPress is the cause of your MySQL problems, you can usually repair the database tables that might be causing the problem. The first step is to verify each of the table’s integrity.
If you use phpMyAdmin, you can do the following:
1. Click the name of your database on the left-hand side
2. Click “Check All” at the bottom to select all tables
3. From the drop down menu, select “Check table”
4. If you find some tables do not have the status “OK”, choose “Repair table”
5. Select tables again and choose “Optimize table”
This may not fix all database problems, but it is a good place to start if you ever experience any. Normally, WordPress should not make MySQL crash, but it is possible, and if it does then you have a memory issue or even a bigger problem such as an uninvited guest on your server.