我使用的是 Linux Mint 19,并使用 MariaDB 作为本地主机中我的 WordPress 站点的数据库服务器。
我尝试运行 MariaDB,当我检查运行状态时
systemctl status mysql.service
我收到这条消息:
● mysql.service - LSB: Start and stop the mysql database server daemon
Loaded: loaded (/etc/init.d/mysql; generated)
Active: failed (Result: exit-code) since Fri 2020-07-24 21:00:26 IDT; 44s ago
Docs: man:systemd-sysv-generator(8)
Process: 2566 ExecStart=/etc/init.d/mysql start (code=exited, status=1/FAILURE)
juil. 24 20:59:56 burslf mysqld[2810]: 2020-07-24 20:59:56 0 [Note] InnoDB: Transaction contains changes to 1 rows
juil. 24 20:59:56 burslf mysqld[2810]: 2020-07-24 20:59:56 0 [Note] InnoDB: 1 transactions in prepared state after recovery
juil. 24 20:59:56 burslf mysqld[2810]: 2020-07-24 20:59:56 0 [Note] Found 1 prepared transaction(s) in InnoDB
juil. 24 20:59:56 burslf mysqld[2810]: 2020-07-24 20:59:56 0 [ERROR] Found 1 prepared transactions! It means that mysqld was not shut down properly last time and critical recovery informati
juil. 24 20:59:56 burslf mysqld[2810]: 2020-07-24 20:59:56 0 [ERROR] Aborting
juil. 24 20:59:56 burslf mysqld[2810]:
juil. 24 21:00:26 burslf mysql[2566]: ...fail!
juil. 24 21:00:26 burslf systemd[1]: mysql.service: Control process exited, code=exited status=1
juil. 24 21:00:26 burslf systemd[1]: mysql.service: Failed with result 'exit-code'.
juil. 24 21:00:26 burslf systemd[1]: Failed to start LSB: Start and stop the mysql database server daemon.
当我启动时journalctl -xe
我得到:
juil. 24 20:55:31 burslf mysqld[9689]: 2020-07-24 20:55:31 0 [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files.
juil. 24 20:55:32 burslf audit[1482]: AVC apparmor="DENIED" operation="sendmsg" info="Failed name lookup - disconnected path" error=-13 profile="/usr/sbin/mysqld" name="run/systemd/notify"
juil. 24 20:55:32 burslf mysqld[1482]: 2020-07-24 20:55:32 0 [Note] InnoDB: Waiting for page_cleaner to finish flushing of buffer pool
juil. 24 20:55:32 burslf kernel: audit: type=1400 audit(1595613332.089:156): apparmor="DENIED" operation="sendmsg" info="Failed name lookup - disconnected path" error=-13 profile="/usr/sbin
juil. 24 20:55:32 burslf mysqld[9689]: 2020-07-24 20:55:32 0 [ERROR] InnoDB: Unable to lock ./ibdata1 error: 11
juil. 24 20:55:32 burslf mysqld[9689]: 2020-07-24 20:55:32 0 [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files.
juil. 24 20:55:33 burslf mysqld[9689]: 2020-07-24 20:55:33 0 [ERROR] InnoDB: Unable to lock ./ibdata1 error: 11
juil. 24 20:55:33 burslf mysqld[9689]: 2020-07-24 20:55:33 0 [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files.
juil. 24 20:55:34 burslf mysqld[9689]: 2020-07-24 20:55:34 0 [ERROR] InnoDB: Unable to lock ./ibdata1 error: 11
juil. 24 20:55:34 burslf mysqld[9689]: 2020-07-24 20:55:34 0 [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files.
juil. 24 20:55:35 burslf mysqld[9689]: 2020-07-24 20:55:35 0 [ERROR] InnoDB: Unable to lock ./ibdata1 error: 11
juil. 24 20:55:35 burslf mysqld[9689]: 2020-07-24 20:55:35 0 [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files.
juil. 24 20:55:36 burslf mysqld[9689]: 2020-07-24 20:55:36 0 [ERROR] InnoDB: Unable to lock ./ibdata1 error: 11
juil. 24 20:55:36 burslf mysqld[9689]: 2020-07-24 20:55:36 0 [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files.
juil. 24 20:55:37 burslf mysqld[9689]: 2020-07-24 20:55:37 0 [ERROR] InnoDB: Unable to lock ./ibdata1 error: 11
juil. 24 20:55:37 burslf mysqld[9689]: 2020-07-24 20:55:37 0 [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files.
juil. 24 20:55:38 burslf mysqld[9689]: 2020-07-24 20:55:38 0 [ERROR] InnoDB: Unable to lock ./ibdata1 error: 11
juil. 24 20:55:38 burslf mysqld[9689]: 2020-07-24 20:55:38 0 [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files.
juil. 24 20:55:39 burslf mysqld[9689]: 2020-07-24 20:55:39 0 [ERROR] InnoDB: Unable to lock ./ibdata1 error: 11
juil. 24 20:55:39 burslf mysqld[9689]: 2020-07-24 20:55:39 0 [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files.
juil. 24 20:55:40 burslf mysqld[9689]: 2020-07-24 20:55:40 0 [ERROR] InnoDB: Unable to lock ./ibdata1 error: 11
juil. 24 20:55:40 burslf mysqld[9689]: 2020-07-24 20:55:40 0 [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files.
juil. 24 20:55:41 burslf mysqld[9689]: 2020-07-24 20:55:41 0 [ERROR] InnoDB: Unable to lock ./ibdata1 error: 11
juil. 24 20:55:41 burslf mysqld[9689]: 2020-07-24 20:55:41 0 [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files.
juil. 24 20:55:42 burslf mysqld[9689]: 2020-07-24 20:55:42 0 [ERROR] InnoDB: Unable to lock ./ibdata1 error: 11
juil. 24 20:55:42 burslf mysqld[9689]: 2020-07-24 20:55:42 0 [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files.
juil. 24 20:55:42 burslf mysqld[9689]: 2020-07-24 20:55:42 0 [Note] InnoDB: Unable to open the first data file
juil. 24 20:55:42 burslf mysqld[9689]: 2020-07-24 20:55:42 0 [ERROR] InnoDB: Operating system error number 11 in a file operation.
juil. 24 20:55:42 burslf mysqld[9689]: 2020-07-24 20:55:42 0 [ERROR] InnoDB: Error number 11 means 'Resource temporarily unavailable'
juil. 24 20:55:42 burslf mysqld[9689]: 2020-07-24 20:55:42 0 [Note] InnoDB: Some operating system error numbers are described at https://mariadb.com/kb/en/library/operating-system-error-cod
juil. 24 20:55:42 burslf mysqld[9689]: 2020-07-24 20:55:42 0 [ERROR] InnoDB: Cannot open datafile './ibdata1'
juil. 24 20:55:42 burslf mysqld[9689]: 2020-07-24 20:55:42 0 [ERROR] InnoDB: Could not open or create the system tablespace. If you tried to add new data files to the system tablespace, and
juil. 24 20:55:42 burslf mysqld[9689]: 2020-07-24 20:55:42 0 [ERROR] InnoDB: Plugin initialization aborted with error Cannot open a file
juil. 24 20:55:42 burslf mysqld[9689]: 2020-07-24 20:55:42 0 [Note] InnoDB: Starting shutdown...
juil. 24 20:55:43 burslf audit[9689]: AVC apparmor="DENIED" operation="sendmsg" info="Failed name lookup - disconnected path" error=-13 profile="/usr/sbin/mysqld" name="run/systemd/notify"
juil. 24 20:55:43 burslf kernel: audit: type=1400 audit(1595613343.029:157): apparmor="DENIED" operation="sendmsg" info="Failed name lookup - disconnected path" error=-13 profile="/usr/sbin
juil. 24 20:55:43 burslf mysqld[9689]: 2020-07-24 20:55:43 0 [ERROR] Plugin 'InnoDB' init function returned error.
juil. 24 20:55:43 burslf mysqld[9689]: 2020-07-24 20:55:43 0 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
juil. 24 20:55:43 burslf mysqld[9689]: 2020-07-24 20:55:43 0 [Note] Plugin 'FEEDBACK' is disabled.
juil. 24 20:55:43 burslf mysqld[9689]: 2020-07-24 20:55:43 0 [ERROR] Unknown/unsupported storage engine: InnoDB
juil. 24 20:55:43 burslf mysqld[9689]: 2020-07-24 20:55:43 0 [ERROR] Aborting
juil. 24 20:55:43 burslf mysqld[9689]: Warning: Memory not freed: 520
juil. 24 20:55:43 burslf audit[9689]: AVC apparmor="DENIED" operation="sendmsg" info="Failed name lookup - disconnected path" error=-13 profile="/usr/sbin/mysqld" name="run/systemd/notify"
juil. 24 20:55:43 burslf audit[9689]: AVC apparmor="DENIED" operation="getattr" info="Failed name lookup - disconnected path" error=-13 profile="/usr/sbin/mysqld" name="dev/null" pid=9689 c
juil. 24 20:55:43 burslf audit[9689]: AVC apparmor="DENIED" operation="getattr" info="Failed name lookup - disconnected path" error=-13 profile="/usr/sbin/mysqld" name="dev/null" pid=9689 c
juil. 24 20:55:43 burslf audit[9689]: AVC apparmor="DENIED" operation="getattr" info="Failed name lookup - disconnected path" error=-13 profile="/usr/sbin/mysqld" name="dev/null" pid=9689 c
juil. 24 20:55:43 burslf systemd[1]: mariadb.service: Main process exited, code=exited, status=1/FAILURE
juil. 24 20:55:43 burslf kernel: audit: type=1400 audit(1595613343.409:158): apparmor="DENIED" operation="sendmsg" info="Failed name lookup - disconnected path" error=-13 profile="/usr/sbin
juil. 24 20:55:43 burslf kernel: audit: type=1400 audit(1595613343.409:159): apparmor="DENIED" operation="getattr" info="Failed name lookup - disconnected path" error=-13 profile="/usr/sbin
juil. 24 20:55:43 burslf kernel: audit: type=1400 audit(1595613343.409:160): apparmor="DENIED" operation="getattr" info="Failed name lookup - disconnected path" error=-13 profile="/usr/sbin
juil. 24 20:55:43 burslf kernel: audit: type=1400 audit(1595613343.409:161): apparmor="DENIED" operation="getattr" info="Failed name lookup - disconnected path" error=-13 profile="/usr/sbin
答案1
主要问题是 InnoDB 引擎未正确初始化。显然已经在运行了。这个答案摘自https://stackoverflow.com/a/35978229/1525392
首先,使用 ps 命令列出 MySQL 进程:
ps aux | grep mysql
然后杀掉进程
sudo kill 56311