Ubuntu-20.04 LTS 上的 Mysql 5.7 失败

Ubuntu-20.04 LTS 上的 Mysql 5.7 失败

我正在关注这个关联安装MYSQL-5.7Ubuntu-20.04LTS

$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 20.04.3 LTS
Release:        20.04
Codename:       focal

$ sudo apt-cache policy mysql-server
mysql-server:
  Installed: (none)
  Candidate: 8.0.27-0ubuntu0.20.04.1
  Version table:
     8.0.27-0ubuntu0.20.04.1 500
        500 http://br.archive.ubuntu.com/ubuntu focal-updates/main amd64 Packages
        500 http://br.archive.ubuntu.com/ubuntu focal-updates/main i386 Packages
        500 http://security.ubuntu.com/ubuntu focal-security/main amd64 Packages
        500 http://security.ubuntu.com/ubuntu focal-security/main i386 Packages
     8.0.19-0ubuntu5 500
        500 http://br.archive.ubuntu.com/ubuntu focal/main amd64 Packages
        500 http://br.archive.ubuntu.com/ubuntu focal/main i386 Packages
     5.7.34-1ubuntu16.04 500
        500 http://repo.mysql.com/apt/ubuntu xenial/mysql-5.7 amd64 Packages

Source.list取自 GitHub关联它仍然指的是 5.7.34-1ubuntu16.04尝试安装sudo apt install -f mysql-client=5.7.34-1ubuntu16.04成功,但是服务器包安装总是失败并出现以下错误。

sudo apt install -f mysql-server=5.7.34-1ubuntu16.04
Created symlink /etc/systemd/system/multi-user.target.wants/mysql.service → /lib/systemd/system/mysql.service.
Job for mysql.service failed because the control process exited with error code.
See "systemctl status mysql.service" and "journalctl -xe" for details.
invoke-rc.d: initscript mysql, action "start" failed.
● mysql.service - MySQL Community Server
     Loaded: loaded (/lib/systemd/system/mysql.service; enabled; vendor preset: enabled)
     Active: activating (auto-restart) (Result: exit-code) since Sun 2021-11-14 16:55:53 IST; 11ms ago
    Process: 17911 ExecStartPre=/usr/share/mysql/mysql-systemd-start pre (code=exited, status=0/SUCCESS)
    Process: 17962 ExecStart=/usr/sbin/mysqld --daemonize --pid-file=/var/run/mysqld/mysqld.pid (code=exited, status=1/FAILURE)
dpkg: error processing package mysql-community-server (--configure):
 installed mysql-community-server package post-installation script subprocess returned error exit status 1
dpkg: dependency problems prevent configuration of mysql-server:
 mysql-server depends on mysql-community-server (= 5.7.34-1ubuntu16.04); however:
  Package mysql-community-server is not configured yet.

dpkg: error processing package mysql-server (--configure):
 dependency problems - leaving unconfigured
Processing triggers for systemd (245.4-4ubuntu3.13) ...
Processing triggers for man-db (2.9.1-1) ...
Processing triggers for ureadahead (0.100.0-21) ...
Processing triggers for libc-bin (2.31-0ubuntu9.2) ...
Errors were encountered while processing:
 mysql-community-server
 mysql-server
E: Sub-process /usr/bin/dpkg returned an error code (1)
$ systemctl status mysql.service
● mysql.service - MySQL Community Server
     Loaded: loaded (/lib/systemd/system/mysql.service; enabled; vendor preset: enabled)
     Active: failed (Result: exit-code) since Sun 2021-11-14 16:55:59 IST; 5min ago
    Process: 18737 ExecStartPre=/usr/share/mysql/mysql-systemd-start pre (code=exited, status=0/SUCCESS)
    Process: 18789 ExecStart=/usr/sbin/mysqld --daemonize --pid-file=/var/run/mysqld/mysqld.pid (code=exited, status=1/FAILURE)

执行以下命令,但无济于事,结果相同。

$ sudo dpkg --configure -a
$ sudo apt install --fix-broken
dpkg: error processing package mysql-community-server (--configure):
 installed mysql-community-server package post-installation script subprocess returned error exit status 1
dpkg: dependency problems prevent configuration of mysql-server:
 mysql-server depends on mysql-community-server (= 5.7.34-1ubuntu16.04); however:
  Package mysql-community-server is not configured yet.

dpkg: error processing package mysql-server (--configure):
 dependency problems - leaving unconfigured
Errors were encountered while processing:
 mysql-community-server
 mysql-server
E: Sub-process /usr/bin/dpkg returned an error code (1)
$ sudo ls /var/cache/apt/archives/
libicu60_60.2-3ubuntu3.2_amd64.deb          mysql-community-server_5.7.36-1ubuntu18.04_amd64.deb  vim_2%3a8.1.2269-1ubuntu5.4_amd64.deb
libopenexr22_2.2.0-11.1ubuntu1.8_amd64.deb  mysql-community-source_5.7.36-1ubuntu18.04_amd64.deb  vim-common_2%3a8.1.2269-1ubuntu5.4_all.deb
lock                                        mysql-server_5.7.36-1ubuntu18.04_amd64.deb            vim-runtime_2%3a8.1.2269-1ubuntu5.4_all.deb
mysql-apt-config_0.8.16-1_all.deb           partial                                               xxd_2%3a8.1.2269-1ubuntu5.4_amd64.deb

我该如何修复这些错误并立即安装 Mysql-5.7?

相关内容