![无法在 Ubuntu 20 上启动 MySQL 社区服务器](https://linux22.com/image/1021462/%E6%97%A0%E6%B3%95%E5%9C%A8%20Ubuntu%2020%20%E4%B8%8A%E5%90%AF%E5%8A%A8%20MySQL%20%E7%A4%BE%E5%8C%BA%E6%9C%8D%E5%8A%A1%E5%99%A8.png)
启动虚拟机时出现错误Failed to start MySQL Community Server
。
我用了systemctl status mysql.service
:
● mysql.service - MySQL Community Server
Loaded: loaded (/lib/systemd/system/mysql.service; enabled; vendor preset: enabled)
Active: activating (start) since Thu 2021-01-21 08:45:54 UTC; 1s ago
Process: 112957 ExecStartPre=/usr/share/mysql/mysql-systemd-start pre (code=exited, status=0/SUCCESS)
Main PID: 112968 (mysqld)
Status: "Server startup in progress"
Tasks: 8 (limit: 18626)
Memory: 472.1M
CGroup: /system.slice/mysql.service
└─112968 /usr/sbin/mysqld
Jan 21 08:45:54 suitecrm.com systemd[1]: Starting MySQL Community Server...
我还使用了journalctl -xe
:
Jan 21 08:44:29 suitecrm.com multipathd[742]: sda: add missing path
Jan 21 08:44:29 suitecrm.com multipathd[742]: sda: failed to get udev uid: Invalid argument
Jan 21 08:44:29 suitecrm.com multipathd[742]: sda: failed to get sysfs uid: Invalid argument
Jan 21 08:44:29 suitecrm.com multipathd[742]: sda: failed to get sgio uid: No such file or directory
Jan 21 08:44:31 suitecrm.com audit[109486]: AVC apparmor="DENIED" operation="open" profile="/usr/sbin/mysqld" name="/proc/109486/task/109652/mem" pid=109486 comm="mysqld" requested_mask="r" denied_mask="r" fs>
Jan 21 08:44:31 suitecrm.com kernel: audit: type=1400 audit(1611218671.020:624): apparmor="DENIED" operation="open" profile="/usr/sbin/mysqld" name="/proc/109486/task/109652/mem" pid=109486 comm="mysqld" requ>
Jan 21 08:44:31 suitecrm.com systemd[1]: mysql.service: Main process exited, code=exited, status=2/INVALIDARGUMENT
-- Subject: Unit process exited
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
--
-- An ExecStart= process belonging to unit mysql.service has exited.
--
-- The process' exit code is 'exited' and its exit status is 2.
Jan 21 08:44:31 suitecrm.com systemd[1]: mysql.service: Failed with result 'exit-code'.
-- Subject: Unit failed
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
--
-- The unit mysql.service has entered the 'failed' state with result 'exit-code'.
Jan 21 08:44:31 suitecrm.com systemd[1]: Failed to start MySQL Community Server.
命令df -h
:
Filesystem Size Used Avail Use% Mounted on
udev 7.6G 0 7.6G 0% /dev
tmpfs 1.6G 1.6M 1.6G 1% /run
/dev/sda2 148G 128G 14G 91% /
tmpfs 7.7G 0 7.7G 0% /dev/shm
tmpfs 5.0M 0 5.0M 0% /run/lock
tmpfs 7.7G 0 7.7G 0% /sys/fs/cgroup
/dev/loop1 56M 56M 0 100% /snap/core18/1944
/dev/loop0 56M 56M 0 100% /snap/core18/1932
/dev/loop2 32M 32M 0 100% /snap/snapd/10492
/dev/loop4 72M 72M 0 100% /snap/lxd/18884
/dev/loop3 32M 32M 0 100% /snap/snapd/10707
/dev/loop6 72M 72M 0 100% /snap/lxd/19009
tmpfs 1.6G 0 1.6G 0% /run/user/1000
日志中没有任何内容/var/log/mysql/error.log
。如何启动 MySQL?
我也遵循了说明(在安全模式下运行 Mysql 服务器):
sudo /etc/init.d/mysql stop
killall mysqld
mysqld_safe --skip-grant-tables&
sudo /etc/init.d/mysql start
在 /var/lib/mysql/mysql_error.log 中我看到这个:
2021-01-21T10:15:18.354232Z 0 [Warning] [MY-010140] [Server] Could not increase number of max_open_files to more than 10000 (request: 80510)
2021-01-21T10:15:18.354243Z 0 [Warning] [MY-010142] [Server] Changed limits: table_open_cache: 4745 (requested 40000)
2021-01-21T10:15:18.613490Z 0 [Warning] [MY-011068] [Server] The syntax 'expire-logs-days' is deprecated and will be removed in a future release. Please use binlog_expire_logs_seconds instead.
2021-01-21T10:15:18.613556Z 0 [Warning] [MY-000076] [Server] option 'slow_query_log': boolean value '2' was not recognized. Set to OFF.
2021-01-21T10:15:18.613574Z 0 [Warning] [MY-010084] [Server] options --log-slow-admin-statements, --log-queries-not-using-indexes and --log-slow-slave-statements have no effect if --slow-query-log is not set
2021-01-21T10:15:18.615324Z 0 [System] [MY-010116] [Server] /usr/sbin/mysqld (mysqld 8.0.22-0ubuntu0.20.04.2) starting as process 317918
2021-01-21T10:15:18.634165Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
2021-01-21T10:15:21.604856Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended.
2021-01-21T10:15:22.524074Z 0 [System] [MY-011323] [Server] X Plugin ready for connections. Bind-address: '::' port: 33060, socket: /var/run/mysqld/mysqlx.sock
2021-01-21T10:15:22.596974Z 0 [ERROR] [MY-013183] [InnoDB] Assertion failure: fut0lst.ic:86:addr.page == FIL_NULL || addr.boffset >= FIL_PAGE_DATA thread 140434928031488