Ubuntu MySQL 使用 apt-get 安装失败

Ubuntu MySQL 使用 apt-get 安装失败

我以前安装过 MariaDB,现在想在我的服务器上安装 MySQL 5.7。我用 mariadb 和 mysql 清除了所有文件。虽然当我安装 MySQL-Server-5.7 时出现以下错误。 (搜索时错误似乎是因为之前安装了 Maria)。另外,在日志中您将看到 mysql-common 是 maria 的一种形式。我不知道这是故意的还是正确的。 (乌班图18.04)

Reading package lists... Done
Building dependency tree
Reading state information... Done
The following additional packages will be installed:
  mysql-client-5.7 mysql-client-core-5.7 mysql-common mysql-server-core-5.7
Suggested packages:
  mailx tinyca
The following NEW packages will be installed:
  mysql-client-5.7 mysql-client-core-5.7 mysql-common mysql-server-5.7 mysql-server-core-5.7
0 upgraded, 5 newly installed, 0 to remove and 0 not upgraded.
Need to get 0 B/19.0 MB of archives.
After this operation, 154 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 ... 93055 files and directories currently installed.)
Preparing to unpack .../mysql-common_1%3a10.4.12+maria~bionic_all.deb ...
Unpacking mysql-common (1:10.4.12+maria~bionic) ...
Selecting previously unselected package mysql-client-core-5.7.
Preparing to unpack .../mysql-client-core-5.7_5.7.29-0ubuntu0.18.04.1_amd64.deb ...
Unpacking mysql-client-core-5.7 (5.7.29-0ubuntu0.18.04.1) ...
Selecting previously unselected package mysql-client-5.7.
Preparing to unpack .../mysql-client-5.7_5.7.29-0ubuntu0.18.04.1_amd64.deb ...
Unpacking mysql-client-5.7 (5.7.29-0ubuntu0.18.04.1) ...
Selecting previously unselected package mysql-server-core-5.7.
Preparing to unpack .../mysql-server-core-5.7_5.7.29-0ubuntu0.18.04.1_amd64.deb ...
Unpacking mysql-server-core-5.7 (5.7.29-0ubuntu0.18.04.1) ...
Setting up mysql-common (1:10.4.12+maria~bionic) ...
Selecting previously unselected package mysql-server-5.7.
(Reading database ... 93203 files and directories currently installed.)
Preparing to unpack .../mysql-server-5.7_5.7.29-0ubuntu0.18.04.1_amd64.deb ...
Unpacking mysql-server-5.7 (5.7.29-0ubuntu0.18.04.1) ...
Setting up mysql-server-core-5.7 (5.7.29-0ubuntu0.18.04.1) ...
Setting up mysql-client-core-5.7 (5.7.29-0ubuntu0.18.04.1) ...
Setting up mysql-client-5.7 (5.7.29-0ubuntu0.18.04.1) ...
Setting up mysql-server-5.7 (5.7.29-0ubuntu0.18.04.1) ...
/var/lib/dpkg/info/mysql-server-5.7.postinst: line 191: /usr/share/mysql-common/configure-symlinks: No such file or directory
dpkg: error processing package mysql-server-5.7 (--configure):
 installed mysql-server-5.7 package post-installation script subprocess returned error exit status 127
Processing triggers for systemd (237-3ubuntu10.38) ...
Processing triggers for man-db (2.8.3-2ubuntu0.1) ...
Processing triggers for ureadahead (0.100.0-21) ...
Errors were encountered while processing:
 mysql-server-5.7
E: Sub-process /usr/bin/dpkg returned an error code (1)```

答案1

如果您在日志中注意到

Preparing to unpack .../mysql-common_1%3a10.4.12+maria~bionic_all.deb ...
Unpacking mysql-common (1:10.4.12+maria~bionic) ...

Maria 仍在使用中,您需要删除 Maria Repo /etc/apt/sources.list.d/mariadb.list,如果这里有它们/etc/apt/sources.list.d

相关内容