DEV Community

Cover image for How to uninstall MySQL Server from Ubuntu 22.04.
Kinyungu Denis
Kinyungu Denis

Posted on

How to uninstall MySQL Server from Ubuntu 22.04.

I am Kinyungu, an IT support specialist and loves to help people to have ease time understanding and using applications.Recently growing a career as a data engineer.

In this article, we look on how to uninstall MySQL server in Ubuntu 22.04. What may cause one to uninstall MySQL server? In case you face unexpected issues while using it or the MySQL server updates or even you willingly decide to uninstall it from your computer.

So follow along and see how we uninstall our MySQL server. Let us do it!!!

First step, we open our Ubuntu terminal, use the shortcut:
CTRL + ALT + T

Good now we are at our terminal, we will write the command to remove MySQL server:

sudo apt-get remove --purge mysql*
Enter fullscreen mode Exit fullscreen mode

Lets explain this command:
sudo enables you to run with root privileges.
apt-get remove this command only uninstalls a package from your machine but the package configuration file remains in your computer.
--purge mysql* It is passed as parameter to the apt-get remove command.

Next let's us remove the purge:

sudo apt-get purge mysql*
Enter fullscreen mode Exit fullscreen mode

Lets understand this command, we know what sudo does.
apt-get purge mysql*, this command will delete all files and directories associated with MySQL.

At this point we have successfully uninstalled MySQL server from our Ubuntu 22.04.
However its advisable to run the following commands so that our MySQL server is uninstalled completely without leaving residue files.

sudo apt-get autoremove
Enter fullscreen mode Exit fullscreen mode
sudo apt-get autoclean
Enter fullscreen mode Exit fullscreen mode

Running the above commands leaves your system clean and you can continue to use your Ubuntu 22.04 well.

This should be considered optional and I would advise one to do this. After uninstalling applications or packages its good to update the system to be up to-date.

We will run this command:

sudo apt-get dist-upgrade
Enter fullscreen mode Exit fullscreen mode

This command will update the repositories packages of applications in the system and also updates the kernel to a new version. It has an intelligent manner to handle dependencies of packages. This will involve to handle conflicts that arise due changes in dependencies or removing dependency packages no longer required. If required it installs new packages that will be required by the new kernel version in our system.

**Yeah!! **Indeed we did uninstall MySQL server.

I hope this article will help anyone uninstalling MySQL server from Ubuntu 22.04 and any other reader looking to learn.

Top comments (7)

Collapse
 
martinnyagah profile image
Martin

Thank you

Collapse
 
kinyungu_denis profile image
Kinyungu Denis

Welcome Martin

Collapse
 
njoroge profile image
Dennis Kamau

Thanks this was useful.
Do you have the steps on how to install MySQL successfully on Ubuntu 22.04?

Collapse
 
kinyungu_denis profile image
Kinyungu Denis

Sure, I will write on this Dennis

Collapse
 
tombnyg420 profile image
Tom

And a year after the last comment, Thank You. Now if I could only install it and get past the default pw problem

Collapse
 
vendkura profile image
Giovanni

Thank you

Collapse
 
justint0x profile image
Justin Touchstone

Thank you!!