Home >Database >Mysql Tutorial >How to Completely Uninstall MySQL 5.7 from Ubuntu 12.04?

How to Completely Uninstall MySQL 5.7 from Ubuntu 12.04?

Mary-Kate Olsen
Mary-Kate OlsenOriginal
2024-11-02 09:32:311155browse

How to Completely Uninstall MySQL 5.7 from Ubuntu 12.04?

Uninstalling MySQL 5.7 Completely on Ubuntu 12.04

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!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn