How to Uninstall MySQL on CentOS 7

To uninstall MySQL on CentOS 7, you can follow these steps:

  1. Stop MySQL service.
  2. Please stop the mysqld service using the systemctl command.
  3. Verify if the MySQL service has been stopped.
  4. Check the status of the MySQL service using systemctl.
  5. Uninstall the MySQL software package.
  6. Please uninstall mysql-server and mysql using the command: sudo yum remove mysql-server mysql
  7. Uninstall dependencies related to MySQL.
  8. Please remove unnecessary packages using the command “sudo yum autoremove”.
  9. Delete the MySQL data directory (which is typically located at /var/lib/mysql).
  10. Delete the directory /var/lib/mysql using root privileges.
  11. Remove the MySQL configuration file:
  12. Delete the my.cnf file in the /etc directory using the sudo command.
  13. Delete MySQL log files.
  14. Remove the file mysqld.log in the directory /var/log using elevated privileges.
  15. Remove MySQL users and groups:
  16. Delete the user and group named “mysql” using sudo.

After completing the above steps, MySQL will be completely uninstalled.

bannerAds