To ensure a thorough removal of MySQL 5.7 from your Ubuntu 12.04 system, follow these steps:
Step 1: Back Up Critical Databases
Begin by backing up essential databases using mysqldump. This step is crucial if you desire to restore data later on. Remember to back up only the essential databases and not the entire database.
Step 2: Shut Down MySQL Processes and Services
Stop the MySQL service and terminate any running MySQL processes using these commands:
sudo service mysql stop #or mysqld sudo killall -9 mysql sudo killall -9 mysqld
Step 3: Purge MySQL-Related Packages
Thoroughly remove MySQL packages and configurations:
sudo apt-get remove --purge mysql-server mysql-client mysql-common sudo apt-get autoremove sudo apt-get autoclean sudo deluser -f mysql
Step 4: Delete MySQL Data Files and Directories
Remove MySQL data files and directories permanently:
sudo rm -rf /var/lib/mysql sudo apt-get purge mysql-server-core-5.7 sudo apt-get purge mysql-client-core-5.7 sudo rm -rf /var/log/mysql sudo rm -rf /etc/mysql
Step 5: Complete Removal
To ensure a comprehensive cleanup, execute the following command:
sudo service mysql stop &&& sudo killall -9 mysql &&& sudo killall -9 mysqld &&& sudo apt-get remove --purge mysql-server mysql-client mysql-common &&& sudo apt-get autoremove &&& sudo apt-get autoclean &&& sudo deluser mysql &&& sudo rm -rf /var/lib/mysql &&& sudo apt-get purge mysql-server-core-5.7 &&& sudo apt-get purge mysql-client-core-5.7 &&& sudo rm -rf /var/log/mysql &&& sudo rm -rf /etc/mysql
The above is the detailed content of How to Completely Uninstall MySQL 5.7 from Ubuntu 12.04?. For more information, please follow other related articles on the PHP Chinese website!