"If a worker wants to do his job well, he must first sharpen his tools." - Confucius, "The Analects of Confucius. Lu Linggong"
Front page > Programming > How to Completely Remove MySQL 5.7 from Ubuntu 12.04?

How to Completely Remove MySQL 5.7 from Ubuntu 12.04?

Published on 2024-11-02
Browse:824

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
Latest tutorial More>

Disclaimer: All resources provided are partly from the Internet. If there is any infringement of your copyright or other rights and interests, please explain the detailed reasons and provide proof of copyright or rights and interests and then send it to the email: [email protected] We will handle it for you as soon as possible.

Copyright© 2022 湘ICP备2022001581号-3