Uninstalling or removing MySQL Server (Ubuntu 16.04)

Having trouble with the existing MySQL server or might want to Uninstall at some point ?

Below are the steps to completely remove MySQL server including dependencies and other related packages or files. Make sure to take a complete backup of your database(s) first.

$ sudo apt-get remove –purge mysql-server mysql-client mysql-common -y
$ sudo apt-get autoremove -y

$ sudo apt-get autoclean

Remove MySQL folder :-

$ sudo rm -rf /etc/mysql

Delete all related Mysql files :-

$ sudo find / -iname ‘mysql*’ -exec rm -rf {} \;

After successful running the above commands your system no longer contains default MySQL related files or dependencies.

Note:- Tutorial tested on EC2 t2.micro instance

Leave a Reply