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

Comment Here

Need WordPress help? Linux Server help? Talk to us.

  • We are your own WordPress customer service.
  • We set up Linux servers and install or migrate WordPress. Learn more here.
  • We support WooCommerce too.
  • Check out our WordPress customer support plans here or contact us below .

If you have any questions regarding WordPress support, Linux server support or any of our services, feel free to reach out or read more on our services page.

Join this free course:

How to host multiple WordPress
websites on a VPS

Close me!