How to uninstall MySQL on Ubuntu 20.04

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.

Read: How to install MySQL on Ubuntu 18.04

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

Read: How to install LAMP on Ubuntu 18.04

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.

 

Marianne elanotta

As a graduate in communication technologies, Marianne likes to share the latest technological advances in various fields. She likes to program in Java OO and Javascript and prefers to work on Open source operating systems. She likes to play chess and computer games in her spare time along with her 2 kids.

Leave a Reply

Close Menu