我无法在 Ubuntu 18.04 或 18.10 上安装 mysql。我从 16.04 升级到 18.04 后遇到了这个问题。在无法让它在分离模式下工作后,我升级到了 18.10
没运气,就是无法安装。
Reading package lists... Done
Building dependency tree
Reading state information... Done
0 upgraded, 0 newly installed, 0 to remove and 264 not upgraded.
2 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Setting up mysql-server-5.7 (5.7.24-0ubuntu0.18.10.1) ...
Renaming removed key_buffer and myisam-recover options (if present)
Specified filename /var/lib/mysql/ibdata1 does not exist.
2018-12-03T06:32:59.012929Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2018-12-03T06:32:59.013024Z 0 [Warning] Can't create test file /storage/mnt/var/lib/mysql/nibiru.lower-test
2018-12-03T06:32:59.013062Z 0 [Note] mysqld (mysqld 5.7.24-0ubuntu0.18.10.1) starting as process 16658 ...
2018-12-03T06:32:59.014400Z 0 [Warning] Can't create test file /var/lib/mysql/nibiru.lower-test
2018-12-03T06:32:59.014413Z 0 [Warning] Can't create test file /var/lib/mysql/nibiru.lower-test
2018-12-03T06:32:59.015547Z 0 [ERROR] Could not open file '/var/log/mysql/error.log' for error logging: Permission denied
2018-12-03T06:32:59.015562Z 0 [ERROR] Aborting
2018-12-03T06:32:59.015574Z 0 [Note] Binlog end
Initialization of mysqld failed: 0
2018-12-03T06:32:59.015613Z 0 [Note] mysqld: Shutdown complete
Warning: Unable to start the server. Please restart MySQL and run mysql_upgrade to ensure the database is ready for use.
Specified filename /var/lib/mysql/ibdata1 does not exist.
2018-12-03T06:32:59.205227Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2018-12-03T06:32:59.205328Z 0 [Warning] Can't create test file /storage/mnt/var/lib/mysql/nibiru.lower-test
2018-12-03T06:32:59.205365Z 0 [Note] mysqld (mysqld 5.7.24-0ubuntu0.18.10.1) starting as process 16666 ...
2018-12-03T06:32:59.206747Z 0 [Warning] Can't create test file /var/lib/mysql/nibiru.lower-test
2018-12-03T06:32:59.206759Z 0 [Warning] Can't create test file /var/lib/mysql/nibiru.lower-test
2018-12-03T06:32:59.207906Z 0 [ERROR] Could not open file '/var/log/mysql/error.log' for error logging: Permission denied
2018-12-03T06:32:59.207933Z 0 [ERROR] Aborting
2018-12-03T06:32:59.207957Z 0 [Note] Binlog end
Initialization of mysqld failed: 0
2018-12-03T06:32:59.207999Z 0 [Note] mysqld: Shutdown complete
Warning: Unable to start the server.
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 Mon 2018-12-03 19:32:59 NZDT; 3ms ago
Process: 16780 ExecStartPre=/usr/share/mysql/mysql-systemd-start pre (code=exited, status=1/FAILURE)
dpkg: error processing package mysql-server-5.7 (--configure):
installed mysql-server-5.7 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-5.7; however:
Package mysql-server-5.7 is not configured yet.
dpkg: error processing package mysql-server (--configure):
dependency problems - leaving unconfigured
Errors were encountered while processing:
mysql-server-5.7
mysql-server
E: Sub-process /usr/bin/dpkg returned an error code (1)
root@nibiru:~#
我知道这与上一个问题几乎一模一样,但我希望能从新的角度来看待这个问题。
答案1
已解决,Apparmor 阻止 mysql 在目录中写入,将 mysql 设置为仅在 apparmor 中抱怨,现在可以正常工作。