You would like to remove MySQL database from your Ubuntu system ? In this short tutorial, you will learn how to safely uninstall MySQL .

Make sure however to create backups of your databases before starting the procedure. In case you have an issue with MySQL, you also have the possibility to repair MySQL.

If MySQL service is up and running, you would need to stop it using the command :

sudo systemctl stop mysql

Remove MySQL database from your Ubuntu 1

You also have to delete any process/daemon related to MySQL by invoking the commands:

sudo killall -9 mysql

sudo killall -9 mysqld

Now the most important commands that will completely remove MySQL (along with its dependent packages) are the following :

sudo apt-get remove –purge mysql-server mysql-client mysql-common mysql-server-core-* mysql-client-core-*

If you had configured your MySQL and created some data, this also needs to be removed for a clean uninstallation.

sudo rm -rf /var/log/mysql

sudo rm -rf /etc/mysql

sudo rm -rf /usr/bin/mysql

sudo deluser -f mysql

Finally carry out the following set of commands to get rid of packages that are no longer necessary:

sudo apt autoremove

Remove MySQL database from your Ubuntu 2

sudo apt autoclean

Remove MySQL database from your Ubuntu 3