5/5 - (4 votes)

Last Updated on February 1, 2021 by Vikash Ekka

Uninstall or Remove MySql from Ubuntu 18.04 LTS and Ubuntu 20.04 LTS
Uninstall or Remove MySql from Ubuntu 18.04 LTS and Ubuntu 20.04 LTS


Introduction


Hey in this tutorial we are going to tell you how you can completely remove or uninstall MySQL of any version from  Ubuntu 18.04 LTS and Ubuntu 20.04 LTS. In this tutorial we are removing MySQL 5.7 , if you have different MySQL version then you can replace it.

Note:- Before uninstalling or removing MySQL make sure you have taken your database backup.

Also Read:- How to Install MySQL 8.0 on Ubuntu 20.04 LTS.

Also Read:- How to install Mysql 5.6 on Ubuntu 18.04 LTS.

Also Read:- How to install MySQL 5.5 on Ubuntu 20.04 LTS.

Also Read:- How To Install Linux, Apache, MySQL, PHP (LAMP) on Ubuntu 16.04, Ubuntu 18.04 and Ubuntu 20.04

Prerequisites:-

Need root user privileges.

Uninstall Mysql Server

sudo apt-get purge mysql-server mysql-client mysql-common mysql-server-core-5.7 mysql-client-core-5.7                  
sudo apt-get remove --purge mysql*
sudo apt-get purge mysql*
sudo apt-get remove dbconfig-mysql
sudo apt-get autoremove
sudo apt-get autoclean
sudo rm -rf /etc/mysql /var/lib/mysql
sudo rm -rf /var/lib/mysql
sudo rm -rf /etc/mysql
sudo apt-get dist-upgrade
sudo apt update

Below commands will remove by killing MySQL services which are running on the servers. Only you have to do is just copy and paste on the terminal.

sudo service mysql stop  #or mysqld
sudo killall -9 mysql
sudo killall -9 mysqld
sudo apt-get remove --purge mysql-server mysql-client mysql-common
sudo apt-get autoremove
sudo apt-get autoclean
sudo deluser -f mysql
sudo rm -rf /var/lib/mysql
sudo apt-get purge mysql-server-core-5.7
sudo apt-get purge mysql-client-core-5.7
sudo rm -rf /var/log/mysql
sudo rm -rf /etc/mysql

Conclusion

Congratulation you have successfully uninstalled MySQL  from your Ubuntu Operating System. Let me know if you are facing any issue in the comment box. I will be very happy to answer those question. Happy learning .

By Vikash Ekka

Hi All, My name is Vikash Ekka from India. I’m the founder and tech editor of https://www.vetechno.in. I have completed my Graduation in BCA. I love to write technical articles like Windows, Linux & MAC Tutorials, Tips, Tricks, How To fix, Tutorials About Ethical Hacking & Cyber Security Guide, and Software Review. Currently, I have been working as an IT professional since 2018.

Leave a Reply

Your email address will not be published. Required fields are marked *