This guide will discuss how to uninstall MySQL from the Linux terminal.
How to Uninstall MySQL From Terminal?
In order to uninstall MySQL from the terminal, first manually stop the MySQL service that is running on the system by typing:
The error-free output means the service of MySQL is stopped successfully:
Remove the MySQL packages as well as its dependencies from the system by following this command:
It will consume some time to select all the packages that should be removed along with MySQL package:
Wait until the uninstallation process is running:
Once the process, run the following command to clear the repositories that are no longer needed:
Wait for this command to complete its execution:
To confirm whether MySQL is completely uninstalled from the system or not, run this command:
This command displays the version number of installed MySQL if this command return “Command ‘mysql’ not found” message it means MySQL is no longer available on your system:
MySQL has been successfully uninstalled from the system using the terminal.
Conclusion
To uninstall MySQL from the terminal, first, stop the MySQL service and run the “sudo apt autoremove mysql-* –purge -y” command to remove MySQL along with its dependencies. Once the packages are uninstalled, run the “sudo apt autoclean” to the repositories that are no longer required. This guide demonstrated how to uninstall MySQL from the terminal.