Completely remove MariaDB 10.01 in Ubuntu 18.04

Viewed 33167

I am having a problem while trying to completely purge Maria DB and install it again.

This is what I do to remove it :

 2073  sudo apt-get remove --purge maria*
 2074  rm -f /var/log/mariadb
 2075  rm -f /var/log/mariadb/mariadb.log
 2076  rm -rf /var/lib/mysql
 2077  rm -rf /usr/lib64/mysql
 2078  rm -rf /usr/share/mysql

And then I attempt to reinstall as :

sudo apt install mariadb-server
mysql_secure_installation

But the problem is once I do it I am being prompted for the root password, which should not be set as I have supposedly purged everything.

Output from mysql_secure_installation :

[~]@Ubuntu1804  #> mysql_secure_installation 

NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDB
      SERVERS IN PRODUCTION USE!  PLEASE READ EACH STEP CAREFULLY!

In order to log into MariaDB to secure it, we'll need the current
password for the root user.  If you've just installed MariaDB, and
you haven't set the root password yet, the password will be blank,
so you should just press enter here.

Enter current password for root (enter for none): 
ERROR 1698 (28000): Access denied for user 'root'@'localhost'
Enter current password for root (enter for none): 
ERROR 1698 (28000): Access denied for user 'root'@'localhost'
Enter current password for root (enter for none): 
Aborting!

If I leave it blank it fails, but If I try with the right password it fails as well.

How can I remove everything related to MariaDB from the server?

2 Answers

Just run this command

sudo apt-get purge mariadb-* 

So in my case, I ended up going to /etc and removing the folder called mysql. It looks obvious but I thought that it would be done automatically when removing? the app via the package manager.

Related