完全删除 MySQL 5.7
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/10853004/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Removing MySQL 5.7 Completely
提问by user1411472
I am trying to uninstall mysql from my ubuntu 12.04 completely. But not able to.
我正在尝试从我的 ubuntu 12.04 中完全卸载 mysql。但是没办法。
I tried a lot of commands. But nothing is working. Can anyone help out here!
我尝试了很多命令。但没有任何效果。任何人都可以在这里帮忙!
sudo apt-get remove mysql-server mysql-client mysql-common
sudo apt-get autoremove
I am not able to understand what to do. I want to remove everything regarding MySQL. Whenever I am trying to locate it. I am getting that.
我不明白该怎么做。我想删除有关 MySQL 的所有内容。每当我试图找到它时。我明白了。
I want everything to be removed. mysql-server, mysql-client, mysql-libraries and even configuration.
我希望一切都被删除。mysql-server、mysql-client、mysql-libraries 甚至配置。
Please help me!!!
请帮我!!!
回答by CodeTower
First of all, do a backup of your needed databases with mysqldump
首先,备份你需要的数据库 mysqldump
Note: If you want to restore later, just backup your relevant databases, and not the WHOLE, because the whole database might actually be the reason you need to purge and reinstall).
注意:如果您想稍后恢复,只需备份您的相关数据库,而不是整个数据库,因为整个数据库实际上可能是您需要清除和重新安装的原因)。
In total, do this:
总的来说,这样做:
sudo service mysql stop #or mysqld
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 -f 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
All above commands in single line (just copy and paste):
以上所有命令都在一行中(只需复制和粘贴):
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
回答by Dylan Knowles
You need to remove the /var/lib/mysql folder. Also, purge when you remove the packages (I'm told this helps).
您需要删除 /var/lib/mysql 文件夹。另外,当你移除包裹时清除(我被告知这有帮助)。
sudo apt-get remove --purge mysql-server mysql-client mysql-common
sudo apt-get remove --purge mysql-server mysql-client mysql-common
sudo rm -rf /var/lib/mysql
sudo rm -rf /var/lib/mysql
I was encountering similar issues. The second line got rid of my issues and allowed me to set up MySql from scratch. Hopefully it helps you too!
我遇到了类似的问题。第二行解决了我的问题,并允许我从头开始设置 MySql。希望对你也有帮助!
回答by E3G
Run these commands in the terminal:
在终端中运行这些命令:
sudo apt-get remove --purge mysql-server mysql-client mysql-common
sudo apt-get autoremove
sudo apt-get autoclean
Run these commands separately as each command requires confirmation & if run as a block, the command below the one currently running will cancel the confirmation (leading to the command not being run).
单独运行这些命令,因为每个命令都需要确认,如果作为一个块运行,当前运行的命令下面的命令将取消确认(导致命令未运行)。
Please refer to How do I uninstall Mysql?
请参考如何卸载Mysql?