Remove MariaDB (MySQL) Databases

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


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.