To uninstall MariaDB from your Ubuntu system, follow these steps:
-
Backup Your Data:
mysqldump -u [username] -p[password] [database_name] > backup.sql
-
Stop the MariaDB service:
Open a terminal and run the following command:
bash
sudo systemctl stop mariadb
-
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
-
Remove MariaDB User and Group:
To ensure a complete uninstallation, remove the MariaDB user and group:
bash
sudo userdel -r mysql
sudo groupdel mysql
-
Remove MariaDB Configuration and Database Files:
sudo rm -rf /etc/mysql/
sudo rm -rf /var/lib/mysql/
-
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.
|