Mysql

無法初始化 MySQL。“來自 pid 文件 /var/run/mariadb/mariadb.pid 的 mysqld_safe mysqld 已結束”

  • October 28, 2018

我正在 Fedora 22 上重新安裝 MySQL。執行 mysql_install_db 後,我嘗試使用 mysqld_safe 啟動守護程序,但它不起作用。系統說:

mysqld_safe Logging to '/var/log/mariadb/mariadb.log'.
mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
mysqld_safe mysqld from pid file /var/run/mariadb/mariadb.pid ended

我怎樣才能讓它工作?

以下是 mariadb.log 的內容:

mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
[Note] /usr/libexec/mysqld (mysqld 10.0.23-MariaDB) starting as process 20443 ...
[Note] InnoDB: Using mutexes to ref count buffer pool pages
[Note] InnoDB: The InnoDB memory heap is disabled
[Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
[Note] InnoDB: Memory barrier is not used
[Note] InnoDB: Compressed tables use zlib 1.2.8
[Note] InnoDB: Using Linux native AIO
[Note] InnoDB: Using CPU crc32 instructions
[Note] InnoDB: Initializing buffer pool, size = 128.0M
[Note] InnoDB: Completed initialization of buffer pool
[ERROR] InnoDB: ./ibdata1 can't be opened in read-write mode
[ERROR] InnoDB: The system tablespace must be writable!
[ERROR] Plugin 'InnoDB' init function returned error.
[ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
[ERROR] mysqld: File '/var/lib/mysql/aria_log_control' not found (Errcode: 13 "Permission denied")
[ERROR] mysqld: Got error 'Can't open file' when trying to use aria control file '/var/lib/mysql/aria_log_control'
[ERROR] Plugin 'Aria' init function returned error.
[ERROR] Plugin 'Aria' registration as a STORAGE ENGINE failed.
[Note] Plugin 'FEEDBACK' is disabled.
[ERROR] Can't open the mysql.plugin table. Please run mysql_upgrade to create it.
[ERROR] Unknown/unsupported storage engine: InnoDB
[ERROR] Aborting
[Note] /usr/libexec/mysqld: Shutdown complete
mysqld_safe mysqld from pid file /var/run/mariadb/mariadb.pid ended

錯誤說:

系統表空間必須是可寫的

請檢查MySQL數據目錄的權限

[ERROR] mysqld: File '/var/lib/mysql/aria_log_control' not found (Errcode: 13 "Permission denied") [ERROR] InnoDB: ./ibdata1 can't be opened in read-write mode [ERROR] InnoDB: The system tablespace must be writable!

這些暗示了該問題的一些潛在原因。

  1. mysql使用者未在主機上正確啟動。
  2. mysql使用者不擁有/var/lib/mysql.
  3. /var/lib/mysql目錄對使用者沒有適當的權限mysql
  4. /var/lib/mysql目錄不存在和/或已滿,因此不可寫。

假設系統上不存在其他未解決的問題,獲得適當的權限以允許mysql使用者寫入指定位置將允許您成功啟動mysqld_safe(以及)。mysqld

引用自:https://dba.stackexchange.com/questions/137619