彻底删除 MySQL Ubuntu 14.04 LTS
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/25244606/
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
Completely Remove MySQL Ubuntu 14.04 LTS
提问by Warsum
I somehow have messed up my MySQL on my Ubuntu server and cannot fix it. I have tried every single combination of apt-get remove --purge mysql-server
, apt-get autoremove
, apt-get purge
, Googled for hours and nothing.
我不知何故弄乱了我的 Ubuntu 服务器上的 MySQL 并且无法修复它。我已经尝试了apt-get remove --purge mysql-server
, apt-get autoremove
, apt-get purge
, 的每一个组合,谷歌搜索了几个小时,什么也没做。
I have literally given up. Every time I try to reinstall I get error. I've had enough. I want to remove every single file associated with MySQL on my server.
我真的放弃了。每次我尝试重新安装时都会出错。我受够了。我想删除服务器上与 MySQL 关联的每个文件。
I get this error every time I try to reinstall which seems to be common but not one "fix" has worked for me. I need to clean my system of everything MySQL.
每次尝试重新安装时都会出现此错误,这似乎很常见,但没有一个“修复”对我有用。我需要清理我的系统中的所有 MySQL。
Unable to set password for the MySQL "root" user
An error occurred while setting the password for the MySQL administrative user. This may have happened because the account already has a password, or
because of a communication problem with the MySQL server.
You should check the account's password after the package installation.
Please read the /usr/share/doc/mysql-server-5.5/README.Debian file for more information.
Please can someone give me a set of command to purge this ungodly database from my system before I do a fresh install of the server.
在我重新安装服务器之前,请有人给我一组命令来从我的系统中清除这个不敬虔的数据库。
Setting up mysql-server-5.5 (5.5.38-0ubuntu0.14.04.1) ...
140811 10:56:44 [Warning] Using unique option prefix key_buffer instead of key_buffer_size is deprecated and will be removed in a future release. Please use the full name instead.
start: Job failed to start
invoke-rc.d: initscript mysql, action "start" failed.
dpkg: error processing package mysql-server-5.5 (--configure):
subprocess installed post-installation script returned error exit status 1
dpkg: dependency problems prevent configuration of mysql-server:
mysql-server depends on mysql-server-5.5; however:
Package mysql-server-5.5 is not configured yet.
dpkg: error processing package mysql-server (--configure):
dependency problems - leaving unconfigured
No apport report written because the error message indicates its a followup error from a previous failure.
Processing triggers for libc-bin (2.19-0ubuntu6.1) ...
Processing triggers for ureadahead (0.100.0-16) ...
Errors were encountered while processing:
mysql-server-5.5
mysql-server
E: Sub-process /usr/bin/dpkg returned an error code (1)
I have literally tried everything. Every single mysql
file is removed and it still will not install properly.
我已经尝试了一切。每个mysql
文件都被删除了,但仍然无法正确安装。
回答by Redaa
To Completly remove Mysql from Ubuntu :
要从 Ubuntu 中完全删除 Mysql:
sudo apt-get remove --purge mysql-server mysql-client mysql-common
sudo apt-get autoremove
sudo apt-get autoclean
after this, if you are having issues with re installing, Try to remove Mysql files in :
在此之后,如果您在重新安装时遇到问题,请尝试删除以下 Mysql 文件:
sudo rm -rf /var/lib/mysql
Hope this helps .
希望这可以帮助 。
回答by Grant
I experienced a similar issue on Ubuntu 14.04 LTS after a MySQL update.
在 MySQL 更新后,我在 Ubuntu 14.04 LTS 上遇到了类似的问题。
I started getting error: "Fatal error: Can't open and lock privilege tables: Incorrect file format 'user'" in /var/log/mysql/error.log
我开始收到错误:“致命错误:无法打开和锁定权限表:/var/log/mysql/error.log 中的文件格式不正确”
MySQL could not start.
MySQL 无法启动。
I resolved it by removing the following directory: /var/lib/mysql/mysql
我通过删除以下目录来解决它:/var/lib/mysql/mysql
sudo rm -rf /var/lib/mysql/mysql
This leaves your other DB related files in place, only removing the mysql related files.
这将保留其他与数据库相关的文件,仅删除与 mysql 相关的文件。
After running these:
运行这些后:
sudo apt-get remove --purge mysql-server mysql-client mysql-common
sudo apt-get autoremove
sudo apt-get autoclean
Then reinstalling mysql:
然后重新安装mysql:
sudo apt-get install mysql-server
It worked perfectly.
它工作得很好。
回答by mastash3ff
Different solution for those still having issues. Hopefully I can help those trying to reinstall Mysql. Note, It's a seek and destroy mission. So be weary. Assuming your root:
对于仍然有问题的人的不同解决方案。希望我可以帮助那些试图重新安装 Mysql 的人。请注意,这是一个寻找和摧毁任务。所以要疲倦。假设你的根:
apt-get purge mysql*
apt-get purge dbconfig-common #the screen used for mysql password
find / -name *mysql* #delete any traces of mysql
#insert apt-get cleanups, autoremove,updates etc.
Originally, something leftover was interfering with my startup of mysqlserver-5.5. These commands ended up resolving the issue for myself.
最初,剩余的东西干扰了我的 mysqlserver-5.5 启动。这些命令最终为我自己解决了这个问题。
回答by WAQAR SHAIKH
The following works:
以下工作:
sudo apt-get --purge remove mysql-client mysql-server mysql-common
sudo apt-get autoremove
回答by mehmoodnisar125
sudo apt-get remove --purge mysql*
sudo apt-get remove --purge mysql*
Remove the MySQL packages fully from the target system.
从目标系统中完全删除 MySQL 包。
sudo apt-get purge mysql*
sudo apt-get 清除 mysql*
Remove all mysql related configuration files.
删除所有与mysql相关的配置文件。
sudo apt-get autoremove
sudo apt-get autoremove
Clean up unused dependencies using autoremove command.
使用 autoremove 命令清理未使用的依赖项。
sudo apt-get autoclean
sudo apt-get 自动清理
To clear all local repository in the target system.
清除目标系统中的所有本地存储库。
sudo apt-get remove dbconfig-mysql
sudo apt-get 删除 dbconfig-mysql
If you also want to delete your local/config files for dbconfig-mysql then this will work.
如果您还想删除 dbconfig-mysql 的本地/配置文件,那么这将起作用。
回答by Lalana Chamika
Use apt to uninstall and remove all MySQL packages:
使用 apt 卸载并删除所有 MySQL 包:
$ sudo apt-get remove --purge mysql-server mysql-client mysql-common -y
$ sudo apt-get autoremove -y
$ sudo apt-get autoclean
Remove the MySQL folder:
删除 MySQL 文件夹:
$ rm -rf /etc/mysql
Delete all MySQL files on your server:
删除服务器上的所有 MySQL 文件:
$ sudo find / -iname 'mysql*' -exec rm -rf {} \;
Your system should no longer contain default MySQL related files.
您的系统不应再包含默认的 MySQL 相关文件。
回答by ExploringApple
Remove /etc/my.cnf file and retry the installation, it worked for me for exactly same problem. :-)
删除 /etc/my.cnf 文件并重试安装,它对我来说完全相同的问题。:-)
回答by Warsum
This is what saved me. Apparently the depackager tries to put things in the wrong tmp folder.
这就是救了我。显然,解包器试图将东西放在错误的 tmp 文件夹中。
回答by Geng Wang
I just had this same issue. It turns out for me, mysql was already installed and working. I just didn't know how to check.
我刚刚遇到了同样的问题。事实证明,mysql 已经安装并运行。我只是不知道如何检查。
$ ps aux | grep mysql
This will show you if mysql is already running. If it is it should return something like this:
这将显示 mysql 是否已经在运行。如果是,它应该返回如下内容:
mysql 24294 0.1 1.3 550012 52784 ? Ssl 15:16 0:06 /usr/sbin/mysqld
gwang 27451 0.0 0.0 15940 924 pts/3 S+ 16:34 0:00 grep --color=auto mysql