Home  >  Article  >  Database  >  How do I completely remove MySQL 5.7 from Ubuntu 12.04?

How do I completely remove MySQL 5.7 from Ubuntu 12.04?

Linda Hamilton
Linda HamiltonOriginal
2024-11-03 17:21:30800browse

How do I completely remove MySQL 5.7 from Ubuntu 12.04?

Removing MySQL 5.7 from Your System

The process of completely uninstalling MySQL 5.7 from an Ubuntu 12.04 system can be challenging. Here's a step-by-step guide to successfully remove all traces of MySQL, including its server, client, and configuration settings.

Backup Your Databases

Before proceeding with the uninstallation, it's essential to back up your vital databases using mysqldump. Ensure you only back up the necessary databases and not the entire database, as purging and reinstalling may be unnecessary if the entire database is causing issues.

Complete Uninstallation

To thoroughly remove MySQL, execute the following commands in sequence:

  1. sudo service mysql stop (or mysqld)
  2. sudo killall -9 mysql
  3. sudo killall -9 mysqld
  4. sudo apt-get remove --purge mysql-server mysql-client mysql-common
  5. sudo apt-get autoremove
  6. sudo apt-get autoclean
  7. sudo deluser -f mysql
  8. sudo rm -rf /var/lib/mysql
  9. sudo apt-get purge mysql-server-core-5.7
  10. sudo apt-get purge mysql-client-core-5.7
  11. sudo rm -rf /var/log/mysql
  12. sudo rm -rf /etc/mysql

Single-Line Command

For convenience, all the above commands can be executed in a single line:

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 do I completely remove 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