MySQL database is the heart of a WordPress installation and errors with WordPress database tend to be particularly worrisome. Several reasons work together to make WordPress and MySQL prone to failure. Error Establishing a Database Connection possibly the most common error shown at WordPress front-end. The “MySQL server has gone away” error is another common error.
It is definite truth that we need to tweak various settings of MySQL, including max_connections
, thread_cache_size
and other MySQL config parameters (which we have discussed in details multiple times in last 10 years in this website). But, knowing the things in a regular manner help in the face of future failure – most commonly the webmaster need to rectify the errors own self with an unmanaged server. It is an agreeable fact that preventing downtime emergencies in MySQL is next to impossible as they are caused by complex combinations of several parameters. But without the knowledge of the causes of emergencies, the time to recover from an acute problem becomes time-consuming matter. Causes of downtime in MySQL can be :
- Upgrade related
- Related to configuration changes
- Schema changes
- Careless upgrades
Some of these problems can be addressed by having development and testing instances. It is completely unsafe to allow an automatic update/upgrade without prior checking. Another separate approach is having a standalone MySQL database instance running on a different server with manually tested MySQL backups. Lack of manpower (and fund) often become the bottleneck to execute the correct plan, sometimes often the preventive measures are known.
---
It is a known fact that avoiding buggy WordPress plugins and themes decrease errors. Larger, older WordPress sites tend to avoid changing their main files of themes and plugins.
It is important to schedule routine activities – login to the server, checking the log files, checking the memory consumption, tally with changes in traffic load and take a note of everything noticed. This kind of routine checks can be made in a weekly manner. Investing 15 minute time behind MySQL server every Sunday may keep you informed about the present condition. It is too important to check the MySQL log files. A non-MySQL related example of value of regular checking log files – 5 years back, I noticed WordPress XML-RPC Attack in Nginx from log files before the site actually became down.
Webhost is a big factor because of the underlying hardware, settings and expert support. Big names do not always offer the best hardware at an affordable cost. Once Rackspace was the best provider for the medium websites at a premium price. Today it is difficult to name one web host as the best one. We have discussed about many low-cost cost web hosts, such as VPSDime who has experienced engineers at support. Low-cost solutions not always the worst.
Follow Stephen Covey’s 4 Quadrants and expect a better uptime.