MySQL completely uninstalled and reinstall but database still exists on Ubuntu 12.04

16,636

Add

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:
16,636

Related videos on Youtube

saby
Author by

saby

Updated on September 18, 2022

Comments

  • saby
    saby over 1 year

    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 it doesn't completely uninstall/repair.

  • Tomas Romero
    Tomas Romero about 9 years
    In my case doing this lead me to this issue stackoverflow.com/questions/28626974/….
  • mirkobrankovic
    mirkobrankovic almost 9 years
    YEs, but don't forget to purge it first sudo apt-get remove --purge mysql-server mysql-client mysql-common