Categories: Ubuntu

How to Remove MySQL on Ubuntu

MySQL is an open-source relational database management system that allows users to store, organize and retrieve data in a well-structured format. This database is a popular choice and used by many web applications and web hosting companies and works well with web servers like Apache and NGINX. However, MySQL does not manage huge databases efficiently and is hard to debug.

So, if users want to remove the currently installed MySQL from the Ubuntu system, they can follow this guide.

How to Remove MySQL on Ubuntu

The Ubuntu users can remove MySQL from the system through the following commands:

Method 1: Remove MySQL on Ubuntu Using apt remove Command

The apt remove command is the simplest and widely used command to remove MySQL from the Ubuntu system. This command removes the package from the “apt” repository. Since, in my case, I have installed MySQL server and client on Ubuntu system, so the command to remove these MySQL packages from the system in given below:

$ sudo apt remove mysql-server mysql-client

The above command only removes the packages associated with MySQL on the Ubuntu system.

Method 2: Remove MySQL on Ubuntu using purge Command

The Ubuntu users can also use the purge command with the MySQL packages to remove them from the system. The command works similar to the “apt remove” command.

$ sudo apt purge mysql-server mysql-client

Sponsored

Method 3: Remove MySQL on Ubuntu Using autoremove Command

If you use the autoremove command with the MySQL packages, it will remove all the packages, configuration settings and associated directories from the Ubuntu system. This command is useful since it frees up more space as compared to the above-mentioned command.

$ sudo apt autoremove mysql-server mysql-client

Method 4: Remove MySQL on Ubuntu Using purge autoremove Command

The Ubuntu users can also use purge command along with autoremove command to completely remove the packages, source directories, configuration settings of MySQL from the system.

$ sudo apt purge –autoremove mysql-server mysql-client

Conclusion

Removing MySQL from the Ubuntu system can be done easily through four different commands. The “apt remove” and “purge” commands work similarly and they remove the MySQL packages from the system. However, the autoremove” and purge –autoremove” commands remove the MySQL packages, configuration settings and source directories from the system, allowing users to free up more space.

Ubuntu Server Admin

Recent Posts

Canonical Releases Ubuntu 25.04 Plucky Puffin

The latest interim release of Ubuntu introduces “devpacks” for popular frameworks like Spring, along with…

3 days ago

Ubuntu 25.04 (Plucky Puffin) Released

Ubuntu 25.04, codenamed “Plucky Puffin”, is here. This release continues Ubuntu’s proud tradition of integrating…

4 days ago

Extended Security Maintenance for Ubuntu 20.04 (Focal Fossa) begins May 29, 2025

Ubuntu released its 20.04 (Focal Fossa) release 5 years ago, on March 23, 2020. As…

4 days ago

Ubuntu 20.04 LTS End Of Life – activate ESM to keep your fleet of devices secure and operational

Focal Fossa will reach the End of Standard Support in May 2025, also known as…

5 days ago

Ubuntu MATE 25.04 Release Notes

Ubuntu MATE 25.04 is ready to soar! 🪽 Celebrating our 10th anniversary as an official…

5 days ago

Ubuntu Weekly Newsletter Issue 887

Welcome to the Ubuntu Weekly Newsletter, Issue 887 for the week of April 6 –…

7 days ago