Database connection errors – steps to fix
Following the February 10 power outage on 123 Reg systems, some of our VPS customers may see an issue on their website similar to "Database connection error".
Chances are this happened due to a MySQL corruption. At the moment, the fastest way to resolve this would be to attempt to repair the database. if that fails you may need to rebuild the server and have it restored from your backups/
The underlying issue is most likely related to a crash related to an unclean shut down. This can be recovered, however, and after taking a backup you can resolve this by doing the following:
- Open the /etc/my.cnf file (MySQL’s config file)
- It should look similar to this (however options may vary):
- Add this line to the end:
- Try starting MySQL again.
- If it fails, change the line you added to my.cnf to:
- Try restarting MySQL again.
- If it still fails, change the line you added to my.cnf to:
- You can keep going up to 6 if needed however this should be a last resort as anything over 3 can cause data loss
- As soon as you get MySQL started, take a full backup of your databases. MySQL is now is read only recovery mode so your sites may not be online but you should take a copy of your data as soon as possible.
- Log in as the root MySQL user, check the DB, exit, stop MySQL and remove the “innodb_force_recovery = […]” line from my.cnf.
- Start MySQL one more time. It should now be running normally
Now you can issue the repair operation:-
The above should work for you and will allow MySQL to start and run however once you do this get this started. There is more information regarding this here --> http://dev.mysql.com/doc/refman/5.5/en/forcing-innodb-recovery.html
The above guide should correct any issues, however if the above fails to work or if you may need to restore from your backups.
If the recovery process fails, and you do not have backups please raise a ticket on our support page and we will attempt to recover your data. Please understand however that we have an extremely large backlog of tickets and we are handling them in chronological order.