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.
If MySQL service is up and running, you would need to stop it using the command :
sudo systemctl stop mysql
Uninstall MySQL Ubuntu: Stop service
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
sudo apt autoclean
Remove MySQL Ubuntu: Autoclean command
If you like the content, we would appreciate your support by buying us a coffee. Thank you so much for your visit and support.