Completely uninstall MariaDB – Debian 11

Last updated on December 16th, 2022 at 08:50 pm.

Note that the following steps will completely purge your MariaDB, configs and all other setup.

  1. Completely remove the current MariaDB package:

In the command below, note that purge has 2 hyphens in front of it.

sudo apt-get  --purge remove "mysql*"  
# Note that purge has 2 hyphens  in front of it.
  1. Remove the MariaDB configuration files:
sudo rm -rf /etc/mysql
  1. Remove the MariaDB data directory:
sudo rm -rf /var/lib/mysql

# You can also remove old log files
sudo rm -rf /var/log/mysql
  1. Remove the MariaDB system user and group:
sudo userdel -r mysql
sudo groupdel mysql

To reinstall mariaDB do:

sudo apt install mariadb-server mariadb-client

Start and enable (start at reboot) Mariadb

sudo systemctl start mariadb && sudo systemctl enable mariadb

Then secure it by following the prompts that follow from this command :

sudo mysql_secure_installation

Recommended VPS Providers

Find out the VPS providers I recommend.

Sign up below to learn how to host multiple WordPress websites on a VPS / Cloud Server.

Comment Here