Home > Database > Mysql Tutorial > body text

How to Completely Remove MySQL 5.7 from Ubuntu 12.04?

Barbara Streisand
Release: 2024-11-03 02:00:29
Original
807 people have browsed it

How to Completely Remove MySQL 5.7 from Ubuntu 12.04?

Removing MySQL 5.7: A Comprehensive Guide to Purge and Uninstall

To completely remove MySQL 5.7 from an Ubuntu 12.04 system, follow these comprehensive steps:

Backup Databases

Before proceeding with the uninstallation, ensure you have backed up your essential databases using the mysqldump utility. Backup only the required databases, as a full database backup may be the root cause of the uninstalling issue.

Stop MySQL Services

  • sudo service mysql stop or sudo mysqld (if installed via a package)
  • sudo killall -9 mysql and sudo killall -9 mysqld (if installed from source)

Uninstall MySQL Packages

  • sudo apt-get remove --purge mysql-server mysql-client mysql-common
  • sudo apt-get autoremove
  • sudo apt-get autoclean

Remove User and MySQL Directory

  • sudo deluser -f mysql
  • sudo rm -rf /var/lib/mysql

Purge MySQL Core Packages

  • sudo apt-get purge mysql-server-core-5.7
  • sudo apt-get purge mysql-client-core-5.7

Remove Logs and Configuration

  • sudo rm -rf /var/log/mysql
  • sudo rm -rf /etc/mysql

As a consolidated command, you can run the following single line to perform all the above steps:

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
Copy after login

The above is the detailed content of How to Completely Remove MySQL 5.7 from Ubuntu 12.04?. For more information, please follow other related articles on the PHP Chinese website!

source:php.cn
Statement of this Website
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
Latest Articles by Author
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template