Page tree

Welcome to FreeSoftwareServers Confluence Wiki

Skip to end of metadata
Go to start of metadata

Ok in a perfect world you have a backup of your SQL DB. But last time this happened my DB was less then 24 hours old, but I had put in 5+ hours into WP! So I followed some troubleshooting steps but eventually decided I wanted to try and reinstall MySQL but without losing my DB's. Wasn't sure it was possible. Well it is!

First off, I would make a backup with CloneZilla.

Try and Reboot to see if that fixes.

Ok lets reinstall MySQL and Backup DB's.

sudo su
cp -R /var/lib/mysql/ /root/mysql && apt-get purge mysql-server-5.1 mysql-common && rm /etc/mysql/ -R

Now check /var/lib/mysql. If the files are still there then I would just fix up permissions and re-install MySQL.

If not Copy them Back via:

mkdir /var/lib/mysql/ && cp /root/mysql/* /var/lib/mysql/ 

Fix Permissions:

chown root:root /var/lib/mysql/ -R 


apt-get install mysql-server php5-mysql # It may give errors about dependancies, copy needed dependacies and string along 


apt-get install mysql-server php5-mysql mysql-core-5.5 

Restart Services:

service apache2 restart && service mysql restart 
  • No labels

1 Comment