我在我的Ubuntu16.04LTS上安装了mysql-server,它运行得很好.
接下来,我安装了mariadb-server和mariadb-client。有一些与MySQL的连接,所以我决定强制卸载所有的MariaDB组件。在那之后,我对MySQL有了问题。所以我决定强行重新安装MySQL..。
我无法卸载mysql-server,因为卸载MariaDB后存在未满足的依赖关系.
因此,我尝试了所有可能的组合与apt-get和dpkg强行移除MySQL和MariaDB的遗骸.最后,不幸的是,我还手动删除了目录树中的所有文件,其中包含了来自MySQL或MariaDB的任何文件.
$ sudo dpkg --audit
The following packages have been unpacked but not yet configured.
They must be configured using dpkg --configure or the configure
menu option in dselect for them to work:
mysql-server MySQL Server meta package depending on latest version
The following packages are missing the list control file in the
database, they need to be reinstalled:
mariadb-client MariaDB database client (metapackage depending on the lat
mariadb-server-10.0 MariaDB database server binaries
mariadb-server-core-10.0 MariaDB database core server files
The following packages are missing the md5sums control file in the
database, they need to be reinstalled:
mariadb-client MariaDB database client (metapackage depending on the lat
mariadb-server-10.0 MariaDB database server binaries
mariadb-server-core-10.0 MariaDB database core server files但是我仍然不能重新安装MySQL,因为与MariaDB相关的依赖项丢失了,反之亦然.
$ sudo apt-get install mysql-server
Reading package lists... Done
Building dependency tree
Reading state information... Done
mysql-server is already the newest version (5.7.22-1ubuntu16.04).
You might want to run 'apt-get -f install' to correct these:
The following packages have unmet dependencies:
mariadb-client : Depends: mariadb-client-10.0 (>= 10.0.34-0ubuntu0.16.04.1) but it is not going to be installed
mariadb-server-10.0 : PreDepends: mariadb-common (>= 10.0.34-0ubuntu0.16.04.1) but it is not going to be installed
Depends: mariadb-client-10.0 (>= 10.0.34-0ubuntu0.16.04.1) but it is not going to be installed
Breaks: mysql-server
mariadb-server-core-10.0 : Depends: mariadb-common (>= 10.0.34-0ubuntu0.16.04.1) but it is not going to be installed
mysql-server : Depends: mysql-community-server (= 5.7.22-1ubuntu16.04) but it is not going to be installed
E: Unmet dependencies. Try 'apt-get -f install' with no packages (or specify a solution).
$ sudo dpkg --configure mysql-server
dpkg: dependency problems prevent configuration of mysql-server:
mysql-server depends on mysql-community-server (= 5.7.22-1ubuntu16.04); however:
Package mysql-community-server is not installed.
mariadb-server-10.0 (10.0.34-0ubuntu0.16.04.1) breaks mysql-server and is installed.
dpkg: error processing package mysql-server (--configure):
dependency problems - leaving unconfigured
Errors were encountered while processing:
mysql-server还有另一份清单:
$ sudo dpkg --list | grep -i mysql
ii dbconfig-mysql 2.0.4ubuntu1 all dbconfig-common MySQL/MariaDB support
ii libdbd-mysql-perl 4.033-1ubuntu0.1 amd64 Perl5 database interface to the MySQL database
ii libmysqlclient20:amd64 5.7.22-0ubuntu0.16.04.1 amd64 MySQL database client library
ii mysql-apt-config 0.8.9-1 all Auto configuration for MySQL APT Repo.
ii mysql-common 5.7.22-0ubuntu0.16.04.1 all MySQL database common files, e.g. /etc/mysql/my.cnf
iU mysql-server 5.7.22-1ubuntu16.04 amd64 MySQL Server meta package depending on latest version
rc mysql-server-5.7 5.7.22-0ubuntu0.16.04.1 amd64 MySQL database server binaries and system database setup
ii php-mysql 1:7.2+60+ubuntu16.04.1+deb.sury.org+1 all MySQL module for PHP [default]
ii php5.6-mysql 5.6.35-1+ubuntu16.04.1+deb.sury.org+1 amd64 MySQL module for PHP
ii php7.2-mysql 7.2.5-1+ubuntu16.04.1+deb.sury.org+1 amd64 MySQL module for PHP
ii phpmyadmin 4:4.5.4.1-2ubuntu2 all MySQL web administration tool
ii python-pymysql 0.7.2-1ubuntu1 all Pure-Python MySQL driver - Python 2.x
$ sudo dpkg --list | grep -i mariadb
ii dbconfig-mysql 2.0.4ubuntu1 all dbconfig-common MySQL/MariaDB support
ii mariadb-client 10.0.34-0ubuntu0.16.04.1 all MariaDB database client (metapackage depending on the latest version)
ii mariadb-server-10.0 10.0.34-0ubuntu0.16.04.1 amd64 MariaDB database server binaries
ii mariadb-server-core-10.0 10.0.34-0ubuntu0.16.04.1 amd64 MariaDB database core server files
$ sudo dpkg -i | grep mysql
dpkg: error: --install needs at least one package archive file argument
$ sudo dpkg -i | grep mariadb
dpkg: error: --install needs at least one package archive file argument实际上,我需要在我的系统上安装MySQL,但是我不能重新安装Ubuntu。
我知道我自己制造了很多问题,但也许比我聪明的人能给我一些有用的建议。
我相信解决这个问题,可以帮助很多处于类似情况的人,其他服务也可以这样做。
发布于 2018-06-05 09:08:41
上帝存在!
这一问题通过以下方式得到解决:
sudo apt-get -f install没有任何其他参数
稍后,通过以下方式显示所有软件包:
sudo dpkg -l | grep mariadb
sudo dpkg -l | grep mysql并按照正确的顺序删除有问题的包:
sudo apt-get --purge autoremove package_name在完全删除所有有问题的软件包后,我可以重新安装MySQL,没有任何问题.
谢谢你@MarkWagner的帮助。
https://serverfault.com/questions/915158
复制相似问题