尝试执行命令来安装 mysql 时,执行时出现以下错误sudo dpkg --configure -a
。
Setting up mysql-community-server (5.7.42-1ubuntu18.04) ...
AppArmor parser error for /etc/apparmor.d/usr.sbin.mysqld in /etc/apparmor.d/usr.sbin.mysqld at line 7: Could not open 'abstractions/mysql'
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 Sat 2023-05-20 01:00:43 IST; 9ms ago
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.42-1ubuntu18.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
如何解决此问题?
另外,当尝试执行时sudo apt-get update && sudo apt-get upgrade
,出现以下错误。
Hit:1 http://repo.mysql.com/apt/ubuntu bionic InRelease
Ign:2 http://dl.google.com/linux/chrome-remote-desktop/deb stable InRelease
Hit:3 https://brave-browser-apt-release.s3.brave.com stable InRelease
Hit:4 http://ppa.launchpad.net/deadsnakes/ppa/ubuntu bionic InRelease
Hit:5 http://in.archive.ubuntu.com/ubuntu bionic InRelease
Hit:6 http://dl.google.com/linux/chrome/deb stable InRelease
Hit:7 http://security.ubuntu.com/ubuntu bionic-security InRelease
Hit:8 http://dl.google.com/linux/chrome-remote-desktop/deb stable Release
Hit:9 http://in.archive.ubuntu.com/ubuntu bionic-updates InRelease
Hit:10 https://deb.nodesource.com/node_14.x bionic InRelease
Hit:11 http://in.archive.ubuntu.com/ubuntu bionic-backports InRelease
Hit:12 https://apt.corretto.aws stable InRelease
Hit:13 http://ppa.launchpad.net/git-core/ppa/ubuntu bionic InRelease
Hit:15 https://scala.jfrog.io/artifactory/debian all InRelease
Ign:16 https://scala.jfrog.io/artifactory/debian InRelease
Hit:17 https://scala.jfrog.io/artifactory/debian Release
Reading package lists... Done
Reading package lists... Done
Building dependency tree
Reading state information... Done
Calculating upgrade... Done
The following packages have been kept back:
chrome-remote-desktop scala
0 upgraded, 0 newly installed, 0 to remove and 2 not upgraded.
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-community-server (5.7.42-1ubuntu18.04) ...
AppArmor parser error for /etc/apparmor.d/usr.sbin.mysqld in /etc/apparmor.d/usr.sbin.mysqld at line 7: Could not open 'abstractions/mysql'
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 Sat 2023-05-20 00:57:17 IST; 8ms ago
Process: 19521 ExecStart=/usr/sbin/mysqld --daemonize --pid-file=/var/run/mysqld/mysqld.pid (code=exited, status=1/FAILURE)
Process: 19453 ExecStartPre=/usr/share/mysql/mysql-systemd-start pre (code=exited, status=0/SUCCESS)
dpkg: error processing package mysql-community-server (--configure):
installed mysql-community-server 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 failure.
dpkg: dependency problems prevent configuration of mysql-server:
mysql-server depends on mysql-community-server (= 5.7.42-1ubuntu18.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 journalctl -n 50 -u mysql.service
systemd[1]: mysql.service: Service hold-off time over, scheduling restart.
systemd[1]: mysql.service: Scheduled restart job, restart counter is at 768.
systemd[1]: Stopped MySQL Community Server.
systemd[1]: Starting MySQL Community Server...
mysql-systemd-start[16963]: AppArmor parser error for /etc/apparmor.d/usr.sbin.mysqld in /etc/apparmor.d/usr.sbin.mysqld at line 7: Could not open 'a
mysqld[17021]: Initialization of mysqld failed: 0
systemd[1]: mysql.service: Control process exited, code=exited status=1
systemd[1]: mysql.service: Failed with result 'exit-code'.
systemd[1]: Failed to start MySQL Community Server.