Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Please help!

There are server issues and MySql is no longer running on our server (Ubuntu). The service is not recognized and needs to be reinstalled. Unfortunately, the database has not been backed up for 48 hours and that is a lot of information.

How do I reinstall MySql AND keep all my database data? Please note - I can't access mysql at all. I can't use command line mysql nor phpmyadmin.

Thanks in advance and let me know if I am missing important details.

share|improve this question
up vote 1 down vote accepted

If the database files are accessible, you can follow these steps:

  1. mv /var/lib/mysql /var/lib/mysql.bkp
  2. sudo apt-get install mysql-server
  3. sudo /etc/init.d/mysql stop
  4. mv /var/lib/mysql.bkp /var/lib/mysql
  5. sudo /etc/init.d/mysql start

It should work if you don't have any table file corruption.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.