How to uninstall MySQL ubuntu

How to uninstall MySQL ubuntu

Spread the love

Today we’ll learn, how to uninstall MySQL from ubuntu.  MySQL is a very popular open-source RDBMS. Initially realized in the year 1995, Since then It’s dominating the Linux stack. Most Linux users prefer to install MySQL as It goes along great with the LAMP stack. But there could be a lot of reason; That may drive you to uninstall this program. One such issue is not working properly on the local machine. Now, you are required to uninstall/remove the program. I’ll share with you the best method, In this article.

MySQL has been sometime accused of draining the battery of your machine. This can’t be noticed of course on your PC, As It’s work with electricity directly. But if you are using a Laptop Or Mac. Then you could clearly notice the difference between both. Even if you want to downgrade your MySQL version then also you uninstall MySQL from ubuntu. Removing MySQL is not at all hard, And very easy to follow through.

Steps to remove MySql in Ubuntu

Step-1:  Get onto your terminal and type in the following command:

sudo apt-get remove --purge MySQL*

Step-2: Once you do that, Enter the following command

sudo apt-get purge MySQL*

Step-3: For removing all the files of MySQL, Enter the following command,

sudo apt-get autoremove

Step-4: Now that we are halfway through we need to clean the files, Enter the following

command sudo apt-get autoclean

Step-5: To remove all the setting and cache files, Enter the following command,

sudo apt-get remove dbconfig-mysql

Step-6: Enter the following command

sudo apt-get dist-upgrade

Step-7: Last Enter,

sudo apt-get install mysql-server.

That’s It.

There are alternate ways to uninstall MySQL from ubuntu

If for any reason you are unable to uninstall the MySQL, Then reboot your machine and try again. Look if something is blocking the way to remove the program. Even after some efforts, you are not able to uninstall. Then here is an alternate way that you can use to remove MySQL from ubuntu completely.

Step-1: Enter the following command, service MySQL stop. (This will block the program to be running in the background. You can do this manually as well, By going to the application and stoping the local server. But this method is easy and very efficient, While using Linux.

Step-2: killall -KILL mysql mysqld_safe mysqld (The Following command will kill all the actives and files running or associated with MySQL)

Step-3: Once you have done the above commands, Enter apt-get –yes purge mysql*

Step-4: apt-get –yes autoremove –purge

Step-5: apt-get autoclean

Step-6: deluser –remove-home mysql

Step-7: delgroup mysql

Step-8: rm -rf /etc/apparmor.d/abstractions/mysql /etc/apparmor.d/cache/usr.sbin.mysqld

Step-9: /etc/mysql /var/lib/mysql /var/log/mysql* /var/log/upstart/mysql.log*

Step-10: /var/run/mysqld ~/.mysql_history

Step-11: updatedb

See Also…

How to install and use tree command mac(Opens in a new browser tab)

How to install notepad++ in ubuntu(Opens in a new browser tab)

Leave a Comment

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

Do NOT follow this link or you will be banned from the site!