Remove Mariadb (Mysql) Databases

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

4

1 Answer

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.

2

Your Answer

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

Maya Lin-Takahashi

Maya Lin-Takahashi

Consumer Tech & Gadget Reviewer

Maya is a hardware enthusiast who tests and reviews smart home devices, smartphones, wearables, and audio gear. She focuses on practical consumer value and build quality.

Share this article
Twitter Facebook Pinterest