Super User is a question and answer site for computer enthusiasts and power users. 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

I need to completely remove MySQL all databases and installation and reinstall, because root is broken. I followed this instructions:

sudo apt-get remove --purge mysql-server mysql-client mysql-common
sudo apt-get autoremove
sudo apt-get autoclean

But when I install again with

sudo apt-get install mysql-server

old databases, old users table with broken users etc. are here, so no completely uninstall/repair

I'm stuck, help please, thank you very much!

share|improve this question
up vote 5 down vote accepted


rm -rf /var/lib/mysql
rm -rf /etc/mysql*

before the install to delete everything, but be careful you can have third parties schemas there like phpmyadmin,... So consider deleting one by one subfolder.

Maybe there is an elegant way of doing this, like mysql_secure_installation

share|improve this answer
thank you, yes few miutes ago solved wit whis commands: rm -rf /var/lib/mysql and rm -rf /etc/mysql* – Desttro Jul 8 '13 at 8:00
excelent! :D :P – mirkobrankovic Jul 8 '13 at 8:02
In my case doing this lead me to this issue…. – canotto90 May 6 '15 at 15:11
YEs, but don't forget to purge it first sudo apt-get remove --purge mysql-server mysql-client mysql-common – mirkobrankovic Jun 22 '15 at 14:22

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .