How to remove mysql / mariadb from your linux system

Did you ever had a problem with mysql and needed to remove it so there where no trace left of it on your system?

I had :)

By accident I installed mariadb rather then mysql-server...not because one is better then the other. I was moving a redmine installation to a new server, on the old one the db was mysl 8, on the new I installed mariadb...well long story short I needed to uninstall mariadb and install mysql 8 :)

How to remove maraiadb or just any mysl server / client software from your linux machine:

  1. stop mysql process
sudo service mysql stop

2. use apt to purge any traces of mysql software from you machine

sudo apt --purge remove "mysql*"

3. remove any config files

sudo mv /etc/mysql/ /tmp/mysql_configs/

4. (optional) remove the old source links (edit the source list file and remove any old links to mysql)

vi /etc/apt/sources.list

DONE! Now you can install the right sql software you wanted form the start.....or needed ;)

Enjoy!