Remove MariaDB (MySQL) Databases

108,954

First, create a backup of {database}:

mysqldump -u {user} -p {database} > /home/$USER/Documents/backup.sql

To remove any trace of mariadb installed through apt-get:

sudo service mysql stop
sudo apt-get --purge remove "mysql*"
sudo rm -rf /etc/mysql/ 

and it is all gone. Including databases and any configuration file.

To check if anything named mysql is gone do a

sudo updatedb

and a

locate mysql

It should be fairly empty (maybe some manual pages or a connector). If though you see a my.cnf amongst the results remove that too.

Share:
108,954

Related videos on Youtube

SteamPunk_Devil
Author by

SteamPunk_Devil

Updated on September 18, 2022

Comments

  • SteamPunk_Devil
    SteamPunk_Devil over 1 year

    How do I completly remove MariaDB so I can reset the root password?

    • Rinzwind
      Rinzwind almost 8 years
      Sorry? What does the 1st have to do with the 2nd? And even if you did mean to reset the password for connecting to the database and not the root password: what does that have to do with removing mariadb?
    • SteamPunk_Devil
      SteamPunk_Devil almost 8 years
      I used apt-get I need to pretty much reset all the passwords to it but think Ive broken it to the stage a complete reset is easier than doing it manually
  • Nathan Basanese
    Nathan Basanese over 5 years
    // , I know this is Ask Ubuntu, but do you have any ideas for how to do this without using the package manager?
  • Rinzwind
    Rinzwind over 5 years
    That depends on the OS you want it for.