Ask Ubuntu is a question and answer site for Ubuntu users and developers. 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

How restore /var/lib/mysql (UBUNTU 10.04) after i delete it?


  1. delete /var/lib/mysql folder

  2. paste new /var/lib/mysql folder with wrong files

  3. delete again /var/lib/mysql folder

  4. clean + reinstall mysql

result after reinstall:/var/lib/mysql folder not exist

Thanks, Yosef

share|improve this question
up vote 3 down vote accepted

Restoring /var/lib/mysql can be done by putting back a backup. If you did not have a backup, you've lost your database. The only thing that can be done is reinstalling the MySQL server:

sudo apt-get --reinstall install mysql-server-5.1

FYI, the MySQL root password is stored in /etc/mysql/debian.cnf.

share|improve this answer
Thanks, I run the command but i see in shell: Unpacking replacement mysql-server-5.1 ... and shell not write after that nothing just waiting for something – Yosef Mar 15 '11 at 13:44
Have you removed your /var/lib/mysql directory before reinstalling? If possible, remove (or rename) /etc/mysql to something else and try again. – Lekensteyn Mar 15 '11 at 13:52
Thanks, Its help when i restart computer. – Yosef Mar 15 '11 at 14:48

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.