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!



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

| 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 stackoverflow.com/questions/28626974/…. – Tomas Romero 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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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