我在使用 MySQL 时遇到了很多问题。事后我感觉这与 App Armor 有关。但现在运行时sudo apt-get install mysql-server
我最终会收到错误。
这是 Apparmor 的问题还是有其他问题?我花了两天时间才弄清楚。我查看了无数的帖子和文章,但似乎都没有什么用。
$ sudo apt-get 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-common mysql-server-8.0
Suggested packages:
mailx tinyca
The following NEW packages will be installed:
mysql-client-8.0 mysql-common mysql-server mysql-server-8.0
0 upgraded, 4 newly installed, 0 to remove and 7 not upgraded.
Need to get 0 B/1,267 kB of archives.
After this operation, 1,744 kB 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 ... 198770 files and directories currently installed.)
Preparing to unpack .../mysql-common_5.8+1.0.5ubuntu2_all.deb ...
Unpacking mysql-common (5.8+1.0.5ubuntu2) ...
Selecting previously unselected package mysql-client-8.0.
Preparing to unpack .../mysql-client-8.0_8.0.20-0ubuntu0.20.04.1_amd64.deb ...
Unpacking mysql-client-8.0 (8.0.20-0ubuntu0.20.04.1) ...
Setting up mysql-common (5.8+1.0.5ubuntu2) ...
update-alternatives: using /etc/mysql/my.cnf.fallback to provide /etc/mysql/my.cnf (my.cnf) in auto mode
Selecting previously unselected package mysql-server-8.0.
(Reading database ... 198799 files and directories currently installed.)
Preparing to unpack .../mysql-server-8.0_8.0.20-0ubuntu0.20.04.1_amd64.deb ...
Unpacking mysql-server-8.0 (8.0.20-0ubuntu0.20.04.1) ...
Selecting previously unselected package mysql-server.
Preparing to unpack .../mysql-server_8.0.20-0ubuntu0.20.04.1_all.deb ...
Unpacking mysql-server (8.0.20-0ubuntu0.20.04.1) ...
Setting up mysql-client-8.0 (8.0.20-0ubuntu0.20.04.1) ...
Setting up mysql-server-8.0 (8.0.20-0ubuntu0.20.04.1) ...
update-alternatives: using /etc/mysql/mysql.cnf to provide /etc/mysql/my.cnf (my.cnf) in auto mode
Renaming removed key_buffer and myisam-recover options (if present)
Cannot stat file /proc/5406/fd/5: Permission denied
Cannot stat file /proc/5406/fd/6: Permission denied
Cannot stat file /proc/5406/fd/7: Permission denied
Cannot stat file /proc/5406/fd/8: Permission denied
Cannot stat file /proc/5406/fd/9: Permission denied
Cannot stat file /proc/5406/fd/40: Permission denied
Cannot stat file /proc/5406/fd/48: Permission denied
Cannot stat file /proc/5406/fd/49: Permission denied
Cannot stat file /proc/5406/fd/57: Permission denied
Cannot stat file /proc/5406/fd/58: Permission denied
Cannot stat file /proc/5406/fd/59: Permission denied
Cannot stat file /proc/5406/fd/60: Permission denied
Cannot stat file /proc/5406/fd/61: Permission denied
Cannot stat file /proc/5406/fd/64: Permission denied
Cannot stat file /proc/5406/fd/66: Permission denied
Cannot stat file /proc/5406/fd/68: Permission denied
Cannot stat file /proc/5406/fd/69: Permission denied
Cannot stat file /proc/5406/fd/70: Permission denied
Cannot stat file /proc/5406/fd/71: Permission denied
Cannot stat file /proc/5406/fd/72: Permission denied
Cannot stat file /proc/5406/fd/73: Permission denied
Cannot stat file /proc/5406/fd/74: Permission denied
Cannot stat file /proc/5406/fd/75: Permission denied
Cannot stat file /proc/5406/fd/76: Permission denied
Cannot stat file /proc/5406/fd/77: Permission denied
Cannot stat file /proc/5406/fd/78: Permission denied
Cannot stat file /proc/5406/fd/79: Permission denied
Cannot stat file /proc/5406/fd/80: Permission denied
Cannot stat file /proc/5406/fd/81: Permission denied
Cannot stat file /proc/5406/fd/82: Permission denied
Cannot stat file /proc/5406/fd/83: Permission denied
Cannot stat file /proc/5406/fd/84: Permission denied
Cannot stat file /proc/5406/fd/1023: Permission denied
Cannot stat file /proc/5420/fd/6: Permission denied
Cannot stat file /proc/5420/fd/7: Permission denied
Cannot stat file /proc/5420/fd/8: Permission denied
Cannot stat file /proc/5420/fd/9: Permission denied
Cannot stat file /proc/5420/fd/10: Permission denied
Cannot stat file /proc/5420/fd/11: Permission denied
Cannot stat file /proc/5434/fd/4: Permission denied
Cannot stat file /proc/5434/fd/7: Permission denied
Cannot stat file /proc/5434/fd/8: Permission denied
Cannot stat file /proc/5434/fd/9: Permission denied
Cannot stat file /proc/5436/fd/4: Permission denied
Cannot stat file /proc/5436/fd/7: Permission denied
Cannot stat file /proc/5436/fd/8: Permission denied
Cannot stat file /proc/5436/fd/9: Permission denied
Cannot stat file /proc/5436/fd/10: Permission denied
Cannot stat file /proc/5436/fd/11: Permission denied
Cannot stat file /proc/5436/fd/103: Permission denied
Cannot stat file /proc/5436/fd/104: Permission denied
Cannot stat file /proc/5438/fd/6: Permission denied
Cannot stat file /proc/5438/fd/7: Permission denied
Cannot stat file /proc/5438/fd/8: Permission denied
Cannot stat file /proc/5438/fd/9: Permission denied
Cannot stat file /proc/5438/fd/10: Permission denied
Cannot stat file /proc/5438/fd/11: Permission denied
Cannot stat file /proc/5438/fd/16: Permission denied
Cannot stat file /proc/5438/fd/17: Permission denied
Cannot stat file /proc/5439/fd/6: Permission denied
Cannot stat file /proc/5439/fd/7: Permission denied
Cannot stat file /proc/5439/fd/8: Permission denied
Cannot stat file /proc/5439/fd/9: Permission denied
Cannot stat file /proc/5439/fd/10: Permission denied
Cannot stat file /proc/5439/fd/11: Permission denied
Cannot stat file /proc/5439/fd/16: Permission denied
Cannot stat file /proc/5439/fd/17: Permission denied
/var/lib/mysql/ibdata1: 6179
ERROR: Database files are locked. Daemon already running?
Warning: Unable to start the server.
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 Tue 2020-05-12 22:12:56 CEST; 4ms ago
Process: 13864 ExecStartPre=/usr/share/mysql/mysql-systemd-start pre (code=exited, status=0/SUCCESS)
Process: 13887 ExecStart=/usr/sbin/mysqld (code=exited, status=1/FAILURE)
Main PID: 13887 (code=exited, status=1/FAILURE)
Status: "Server startup in progress"
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 failure.
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
Processing triggers for man-db (2.9.1-1) ...
Processing triggers for systemd (245.4-4ubuntu3) ...
Errors were encountered while processing:
mysql-server-8.0
mysql-server
E: Sub-process /usr/bin/dpkg returned an error code (1)