To remove MySQL from your Ubuntu system, follow these steps:
-
Stop the MySQL service:
sudo systemctl stop mysql
-
Uninstall the MySQL packages:
sudo apt-get purge mysql-server mysql-client
-
Remove the MySQL data directory:
sudo rm -rf /var/lib/mysql
-
Remove the MySQL configuration files:
sudo rm -rf /etc/mysql
-
Clean up the package cache:
sudo apt-get autoremove
-
Verify removal:
dpkg -l | grep mysql
If no MySQL packages are listed, the removal was successful.
Important Notes:
- This will completely remove MySQL from your system, including all data and configuration files.
- Back up your data before proceeding, as this process is irreversible.
- If you are using a different version of MySQL, such as MariaDB, the package names may vary.