Rhel

mysql伺服器沒有啟動

  • February 16, 2016

我使用 mysql57-community-release-el6-7.noarch.rpm Repo 在 RHEL 6.5 上安裝了 Mysql server 5.7.9。並且安裝成功,但是當我嘗試啟動它並給出錯誤時。從 /var/log/mysqld.log 我得到這些日誌

> 2016-02-16T08:16:55.473839Z 0 [Note] InnoDB: PUNCH HOLE support
> available 2016-02-16T08:16:55.473945Z 0 [Note] InnoDB: Mutexes and
> rw_locks use GCC atomic builtins 2016-02-16T08:16:55.473983Z 0 [Note]
> InnoDB: Uses event mutexes 2016-02-16T08:16:55.474011Z 0 [Note]
> InnoDB: GCC builtin __sync_synchronize() is used for memory barrier
> 2016-02-16T08:16:55.474038Z 0 [Note] InnoDB: Compressed tables use
> zlib 1.2.3 2016-02-16T08:16:55.474062Z 0 [Note] InnoDB: Using Linux
> native AIO 2016-02-16T08:16:55.474908Z 0 [Note] InnoDB: Number of
> pools: 1 2016-02-16T08:16:55.475257Z 0 [Note] InnoDB: Not using CPU
> crc32 instructions mysqld: Can't create/write to file '/tmp/ibUFqzVe'
> (Errcode: 13 - Permission denied) 2016-02-16T08:16:55.475430Z 0
> [ERROR] InnoDB: Unable to create temporary file; errno: 13
> 2016-02-16T08:16:55.475460Z 0 [ERROR] InnoDB: Plugin initialization
> aborted with error Generic error 2016-02-16T08:16:55.475490Z 0 [ERROR]
> Plugin 'InnoDB' init function returned error.
> 2016-02-16T08:16:55.475515Z 0 [ERROR] Plugin 'InnoDB' registration as
> a STORAGE ENGINE failed. 2016-02-16T08:16:55.475536Z 0 [ERROR] Failed
> to initialize plugins. 2016-02-16T08:16:55.475557Z 0 [ERROR] Aborting
> 
> 2016-02-16T08:16:55.475583Z 0 [Note] Binlog end
> 2016-02-16T08:16:55.475695Z 0 [Note] Shutting down plugin
> 'keyring_file' 2016-02-16T08:16:55.476442Z 0 [Note] /usr/sbin/mysqld:
> Shutdown complete
> 
> 2016-02-16T08:16:55.502968Z mysqld_safe mysqld from pid file
> /var/run/mysqld/mysqld.pid ended

任何建議這個錯誤在說什麼……

MySQL 伺服器無法訪問您的 /tmp 目錄,無法寫入和創建臨時文件。確保 /tmp 目錄歸 root 使用者所有,並且在 /tmp 目錄上設置了粘滯位。鍵入以下命令來修復此錯誤。您必須以 root 使用者身份登錄並輸入:

chown root:root /tmp

chmod 1777 /tmp

測試一下

/etc/init.d/mysqld 啟動

> [ERROR] InnoDB: Unable to create temporary file; errno: 13

這條線在那裡看起來有問題。嘗試檢查/tmpdir 是否存在(它應該)並且可用於 mysql 使用者(或您使用的使用者)。您可以嘗試--tmpdir在配置中使用不同的路徑或選項,更多資訊見 docs)。

SELinux 也可能有問題(如果它處於強制模式)。ausearch -ts today -m avc | audit2allow如果 /tmp 目錄沒有為 mysql 阻止,請檢查您的審核日誌(例如,使用)。對於測試,您可以使用setenforce 0.

引用自:https://unix.stackexchange.com/questions/263576