Uninstall MYSQL on Ubuntu in the cleanest way!
If #MySQL is running, you need to stop it using the following command.
sudo systemctl stop mysql
#You should also stop MySQL related daemons
sudo killall -9 mysql
sudo killall -9 mysqld
#If you have configured your MySQL, delete all directories and users for complete removal.
sudo rm -rf /var/log/mysql
sudo rm -rf /etc/mysql
sudo rm -rf /usr/bin/mysql
sudo rm -rf /var/lib/mysql
sudo deluser -f mysql
#MySQL Ubuntu packages start with "mysql-server", remove all these packages.
sudo apt-get remove --purge mysql*
sudo apt-get purge mysql-server*
Run the command below to uninstall #MySQL.
sudo apt-get purge mysql*
#Run autoremove to remove all dependency packages installed by MySQL.
sudo apt-get autoremove
#Deleting downloaded packages (from archive-repo)
sudo apt-get autoclean
#Delete the database config file.
sudo apt-get remove dbconfig-mysql
This post is licensed under CC BY 4.0 by the author.