MySQL 安装失败

MySQL 安装失败

我正在运行 Ubuntu 20.10 并尝试安装 MySql 服务器。我之前在连接数据库时遇到错误,另一篇文章建议清除并重新安装。我尝试搜索错误,但找不到任何相关帮助。以下是 apt intall 期间的输出:

sudo apt install mysql-server
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following additional packages will be installed:
  mysql-client-8.0 mysql-server-8.0
Suggested packages:
  mailx tinyca
The following NEW packages will be installed:
  mysql-client-8.0 mysql-server mysql-server-8.0
0 upgraded, 3 newly installed, 0 to remove and 0 not upgraded.
Need to get 0 B/1,355 kB of archives.
After this operation, 1,798 kB of additional disk space will be used.
Do you want to continue? [Y/n] y
Preconfiguring packages ...
Selecting previously unselected package mysql-client-8.0.
(Reading database ... 270231 files and directories currently installed.)
Preparing to unpack .../mysql-client-8.0_8.0.23-0ubuntu0.20.10.1_amd64.deb ...
Unpacking mysql-client-8.0 (8.0.23-0ubuntu0.20.10.1) ...
Selecting previously unselected package mysql-server-8.0.
Preparing to unpack .../mysql-server-8.0_8.0.23-0ubuntu0.20.10.1_amd64.deb ...
grep: /etc/mysql/: No such file or directory
Unpacking mysql-server-8.0 (8.0.23-0ubuntu0.20.10.1) ...
Selecting previously unselected package mysql-server.
Preparing to unpack .../mysql-server_8.0.23-0ubuntu0.20.10.1_all.deb ...
Unpacking mysql-server (8.0.23-0ubuntu0.20.10.1) ...
Setting up mysql-client-8.0 (8.0.23-0ubuntu0.20.10.1) ...
Setting up mysql-server-8.0 (8.0.23-0ubuntu0.20.10.1) ...
Renaming removed key_buffer and myisam-recover options (if present)
mysqld: Can't open shared library '/usr/lib/mysql/plugin/component_reference_cache.so' (errno: 0 /us
r/lib/mysql/plugin/component_reference_cache.so: cannot open shared object file: No such file or dir
ectory)
mysqld: Cannot load component from specified URN: 'file://component_reference_cache'.
mysqld will log errors to /var/lib/mysql/david-laptop.err
mysqld is running as pid 12368
Created symlink /etc/systemd/system/multi-user.target.wants/mysql.service → /lib/systemd/system/mysq
l.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 Thu 2021-03-04 17:56:43 EST; 4ms ag
o
    Process: 12506 ExecStartPre=/usr/share/mysql/mysql-systemd-start pre (code=exited, status=1/FAIL
URE)
dpkg: error processing package mysql-server-8.0 (--configure):
 installed mysql-server-8.0 package post-installation script subprocess returned error exit status 1
dpkg: dependency problems prevent configuration of mysql-server:
 mysql-server depends on mysql-server-8.0; however:
  Package mysql-server-8.0 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 fa
ilure.
      Processing triggers for man-db (2.9.3-2) ...
Processing triggers for systemd (246.6-1ubuntu1.1pop0~1613764432~20.10~90cdde7) ...
Errors were encountered while processing:
 mysql-server-8.0
 mysql-server
E: Sub-process /usr/bin/dpkg returned an error code (1)

我尝试按照以下说明卸载如何彻底卸载 MySQL?然后重新安装并出现一些不同的错误:

The following NEW packages will be installed:
  mysql-client-8.0 mysql-client-core-8.0 mysql-server mysql-server-8.0 mysql-server-core-8.0
0 upgraded, 5 newly installed, 0 to remove and 0 not upgraded.
Need to get 0 B/22.7 MB of archives.
After this operation, 188 MB of additional disk space will be used.
Do you want to continue? [Y/n] y
Preconfiguring packages ...
Selecting previously unselected package mysql-client-core-8.0.
(Reading database ... 269893 files and directories currently installed.)
Preparing to unpack .../mysql-client-core-8.0_8.0.23-0ubuntu0.20.10.1_amd64.deb ...
Unpacking mysql-client-core-8.0 (8.0.23-0ubuntu0.20.10.1) ...
Selecting previously unselected package mysql-client-8.0.
Preparing to unpack .../mysql-client-8.0_8.0.23-0ubuntu0.20.10.1_amd64.deb ...
Unpacking mysql-client-8.0 (8.0.23-0ubuntu0.20.10.1) ...
Selecting previously unselected package mysql-server-core-8.0.
Preparing to unpack .../mysql-server-core-8.0_8.0.23-0ubuntu0.20.10.1_amd64.deb ...
Unpacking mysql-server-core-8.0 (8.0.23-0ubuntu0.20.10.1) ...
Selecting previously unselected package mysql-server-8.0.
Preparing to unpack .../mysql-server-8.0_8.0.23-0ubuntu0.20.10.1_amd64.deb ...
grep: /etc/mysql/: No such file or directory
Unpacking mysql-server-8.0 (8.0.23-0ubuntu0.20.10.1) ...
Selecting previously unselected package mysql-server.
Preparing to unpack .../mysql-server_8.0.23-0ubuntu0.20.10.1_all.deb ...
Unpacking mysql-server (8.0.23-0ubuntu0.20.10.1) ...
Setting up mysql-client-core-8.0 (8.0.23-0ubuntu0.20.10.1) ...
Setting up mysql-server-core-8.0 (8.0.23-0ubuntu0.20.10.1) ...
Setting up mysql-client-8.0 (8.0.23-0ubuntu0.20.10.1) ...
Setting up mysql-server-8.0 (8.0.23-0ubuntu0.20.10.1) ...
Renaming removed key_buffer and myisam-recover options (if present)
mysqld will log errors to /var/lib/mysql/david-laptop.err
mysqld is running as pid 16985
AppArmor parser error for /etc/apparmor.d/usr.sbin.mysqld in profile /etc/apparmor.d/usr.sbin.mysqld
 at line 9: Could not open 'abstractions/mysql'
Created symlink /etc/systemd/system/multi-user.target.wants/mysql.service → /lib/systemd/system/mysq
l.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 Thu 2021-03-04 18:31:40 EST; 4ms ag
o
    Process: 17178 ExecStartPre=/usr/share/mysql/mysql-systemd-start pre (code=exited, status=1/FAIL
URE)
dpkg: error processing package mysql-server-8.0 (--configure):
 installed mysql-server-8.0 package post-installation script subprocess returned error exit status 1
dpkg: dependency problems prevent configuration of mysql-server:
 mysql-server depends on mysql-server-8.0; however:
  Package mysql-server-8.0 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 fa
ilure.
      Processing triggers for man-db (2.9.3-2) ...
Processing triggers for systemd (246.6-1ubuntu1.1pop0~1613764432~20.10~90cdde7) ...
Errors were encountered while processing:
 mysql-server-8.0
 mysql-server
E: Sub-process /usr/bin/dpkg returned an error code (1)

现在,当我尝试清除时,出现与上述相同的错误。

在浏览了大量不同的帮助文章后,我解决了大多数错误。但我现在陷入了困境:

2 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Do you want to continue? [Y/n] y
Setting up mysql-server-8.0 (8.0.23-0ubuntu0.20.10.1) ...
Renaming removed key_buffer and myisam-recover options (if present)
mysqld will log errors to /var/lib/mysql/david-laptop.err
mysqld is running as pid 15970
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 Thu 2021-03-04 20:51:43 EST; 4ms ag
o
    Process: 16138 ExecStartPre=/usr/share/mysql/mysql-systemd-start pre (code=exited, status=1/FAIL
URE)
dpkg: error processing package mysql-server-8.0 (--configure):
 installed mysql-server-8.0 package post-installation script subprocess returned error exit status 1
No apport report written because the error message indicates its a followup error from a previous fa
ilure.
      dpkg: dependency problems prevent configuration of mysql-server:
 mysql-server depends on mysql-server-8.0; however:
  Package mysql-server-8.0 is not configured yet.

dpkg: error processing package mysql-server (--configure):
 dependency problems - leaving unconfigured
Errors were encountered while processing:
 mysql-server-8.0
 mysql-server
E: Sub-process /usr/bin/dpkg returned an error code (1)

答案1

输出中最有趣的错误如下:

配置文件 /etc/apparmor.d/usr.sbin.mysqld 中的 AppArmor 解析器错误位于第 9 行:无法打开“abstractions/mysql”

所提及的抽象/mysql文件来自装甲包。您必须使用以下命令重新安装它:

sudo apt-get install --reinstall -o Dpkg::Options::="--force-confask,confnew,confmiss" apparmor

然后恢复 MySQL 服务器的安装。

相关内容