Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I had to reboot in the middle of a large data import. I only have one mysql database, which has now been corrupted.

How can I completely remove mysql and reinstall it? I've tried apt-get purge mysql-server, then removing /var/lib/mysql/* and reinstalling, but apt-get does not prompt me for a root name and password nor does it recreate the /var/lib/mysql files. How can I reinstall?

share|improve this question

1 Answer 1

up vote 7 down vote accepted

You should do the following:

apt-get purge mysql-server mysql-common mysql-client-<version>
rm -rf /var/lib/mysql
rm -rf /etc/mysql*

Then you can reinstall in full.

share|improve this answer
thanks! also had to add the version to mysql-server-<version> –  cwd Dec 24 '11 at 6:11

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.