如何完全删除MySQL以进行全新安装


14

我需要完全删除有关MySQL的所有内容。它没有开始,所以我决定删除它。但是,在安装过程中发生了以下情况:

sta@daPC:~$ sudo apt-get install mysql-server
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following extra packages will be installed:
  libdbd-mysql-perl libmysqlclient18 mysql-client-5.6 mysql-common
  mysql-server-5.6
Suggested packages:
  mailx tinyca
The following NEW packages will be installed:
  libdbd-mysql-perl libmysqlclient18 mysql-client-5.6 mysql-common
  mysql-server mysql-server-5.6
0 upgraded, 6 newly installed, 0 to remove and 87 not upgraded.
Need to get 0 B/12,0 MB of archives.
After this operation, 101 MB of additional disk space will be used.
Do you want to continue? [Y/n] Y
Preconfiguring packages ...
Selecting previously unselected package mysql-common.
(Reading database ... 188526 files and directories currently installed.)
Preparing to unpack .../mysql-common_5.6.28-0ubuntu0.15.10.1_all.deb ...
Unpacking mysql-common (5.6.28-0ubuntu0.15.10.1) ...
Selecting previously unselected package libmysqlclient18:i386.
Preparing to unpack .../libmysqlclient18_5.6.28-0ubuntu0.15.10.1_i386.deb ...
Unpacking libmysqlclient18:i386 (5.6.28-0ubuntu0.15.10.1) ...
Selecting previously unselected package libdbd-mysql-perl.
Preparing to unpack .../libdbd-mysql-perl_4.028-2_i386.deb ...
Unpacking libdbd-mysql-perl (4.028-2) ...
Selecting previously unselected package mysql-client-5.6.
Preparing to unpack .../mysql-client-5.6_5.6.28-0ubuntu0.15.10.1_i386.deb ...
Unpacking mysql-client-5.6 (5.6.28-0ubuntu0.15.10.1) ...
Processing triggers for man-db (2.7.4-1) ...
Setting up mysql-common (5.6.28-0ubuntu0.15.10.1) ...
update-alternatives: using /etc/mysql/my.cnf.fallback to provide /etc/mysql/my.cnf (my.cnf) in auto mode
Selecting previously unselected package mysql-server-5.6.
(Reading database ... 188621 files and directories currently installed.)
Preparing to unpack .../mysql-server-5.6_5.6.28-0ubuntu0.15.10.1_i386.deb ...
Unpacking mysql-server-5.6 (5.6.28-0ubuntu0.15.10.1) ...
Selecting previously unselected package mysql-server.
Preparing to unpack .../mysql-server_5.6.28-0ubuntu0.15.10.1_all.deb ...
Unpacking mysql-server (5.6.28-0ubuntu0.15.10.1) ...
Processing triggers for man-db (2.7.4-1) ...
Processing triggers for ureadahead (0.100.0-19) ...
ureadahead will be reprofiled on next reboot
Processing triggers for systemd (225-1ubuntu9) ...
Setting up libmysqlclient18:i386 (5.6.28-0ubuntu0.15.10.1) ...
Setting up libdbd-mysql-perl (4.028-2) ...
Setting up mysql-client-5.6 (5.6.28-0ubuntu0.15.10.1) ...
Setting up mysql-server-5.6 (5.6.28-0ubuntu0.15.10.1) ...
update-alternatives: using /etc/mysql/mysql.cnf to provide /etc/mysql/my.cnf (my.cnf) in auto mode
2016-02-17 04:13:48 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2016-02-17 04:13:48 0 [Note] /usr/sbin/mysqld (mysqld 5.6.28-0ubuntu0.15.10.1) starting as process 13491 ...

如您所见,它停留在再次启动MySQL服务器上。如何删除MySQL的完全全新安装?

编辑:重新启动计算机后问题自行解决。由于我既找不到问题,也找不到实际的解决方案,因此我没有将其发布为答案。

Answers:


26

我在以下位置找到了解决方案:https : //stackoverflow.com/questions/25244606/completely-remove-mysql-ubuntu-14-04-lts/28113482#28113482

sudo rm -rf /var/lib/mysql/mysql
sudo apt-get remove --purge mysql-server mysql-client mysql-common
sudo apt-get autoremove
sudo apt-get autoclean
sudo apt-get install mysql-server

在重新安装期间,系统提示我输入(新)密码。在先前未成功安装的过程中,我将其清空,而mysql保留了以前安装的旧密码,我认为该密码是空的。


0

dpkg -P软件包应完全清除该软件包,包括配置文件。以下是man dpkg命令中的选项说明

-r,-删除,-P,-清除程序包... | -a |-待定 删除已安装的程序包。-r或--remove删除除配置文件以外的所有内容。如果稍后重新安装,则可以避免重新配置包装寿命。(配置文件是在DEBIAN / conffiles控制文件中列出的配置文件)。-P或--purge删除所有内容,包括conffiles。如果给出-a或--pending而不是软件包名称,则分别除去或清除所有解压缩但标记为要在文件/ var / lib / dpkg / status中除去或清除的软件包。注意:dpkg可能不了解某些配置文件,因为它们是通过配置脚本单独创建和处理的。在这种情况下,dpkg不会单独删除它们,但是程序包的postrm脚本(由dpkg调用)必须在清除期间照顾它们的删除。当然,这仅适用于系统目录中的文件,不适用于写入单个用户主目录的配置文件。


0

您必须使用清除:

   remove
       remove is identical to install except that packages are removed
       instead of installed. Note the removing a package leaves its
       configuration files in system. If a plus sign is appended to the
       package name (with no intervening space), the identified package
       will be installed instead of removed.

   purge
       purge is identical to remove except that packages are removed and
       purged (any configuration files are deleted too).

   --purge
       Use purge instead of remove for anything that would be removed. An
       asterisk ("*") will be displayed next to packages which are
       scheduled to be purged.  remove --purge is equivalent for purge
       command. Configuration Item: APT::Get::Purge.

句法:

 sudo apt-get remove --purge <package-name>

或其等效项:

 sudo apt-get purge <package-name>

希望能帮助到你。


试过了 还是一样。
SarpSTA '16

你检查哪些进程正在运行3309
rɑːdʒɑ
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.