How to Uninstall MariaDB on Ubuntu

To uninstall MariaDB from your Ubuntu system, follow these steps:

  1. Backup Your Data: mysqldump -u [username] -p[password] [database_name] > backup.sql

  2. Stop the MariaDB service: Open a terminal and run the following command: bash sudo systemctl stop mariadb

  3. Uninstall MariaDB: You can use the apt package manager to uninstall MariaDB. Run the following command: bash sudo apt-get remove --purge mariadb-server mariadb-client mariadb-common

    or

    sudo apt purge mysql-server mysql-common mysql-server-core-* mysql-client-core-*

    sudo apt-get autoremove

    sudo apt-get autoclean

  4. Remove MariaDB User and Group: To ensure a complete uninstallation, remove the MariaDB user and group: bash sudo userdel -r mysql sudo groupdel mysql

  5. Remove MariaDB Configuration and Database Files: sudo rm -rf /etc/mysql/ sudo rm -rf /var/lib/mysql/

  6. Clean the logs: sudo rm -rf /var/log/mysql

This will clean up any remaining files associated with MariaDB.

MariaDB should now be completely removed from your Ubuntu system.