Completely delete clean mysql (including configuration files) in ubuntu

1Delete mysql data files

sudo rm /var/lib/mysql/ -R

2 Delete the mysql configuration file

sudo rm /etc/mysql/ -R

(These two steps are very important and many articles have not written them)

3 dpkg --list|grep mysql to view mysql dependencies

 4 Start removing dependencies

 4.1 Uninstall command: sudo apt-get remove mysql-common

4.2 Uninstall command: sudo apt-get autoremove --purge mysql-server-8.0

4.3 To clear residual data, run the command: dpkg -l|grep ^rc|awk '{print$2}'|sudo xargs dpkg -P

Check the remaining dependencies of MySQL again and run the command: dpkg --list|grep mysql

If there is no return, the deletion is complete (basically it will be deleted). If it is not deleted, continue to delete the displayed dependent packages.

Finish!

おすすめ

転載: blog.csdn.net/qq_52135683/article/details/126857974