![chown root:root /tmp](https://rvso.com/image/83694/chown%20root%3Aroot%20%2Ftmp.png)
我使用 mysql57-community-release-el6-7.noarch.rpm Repo 在 RHEL 6.5 上安裝了 Mysql 伺服器 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
任何建議這個錯誤正在談論什麼...
答案1
MySQL 伺服器無法存取您的 /tmp 目錄、寫入和建立臨時檔案。確保 /tmp 目錄由 root 使用者擁有,並且在 /tmp 目錄上設定了黏滯位。鍵入以下命令來修復此錯誤。您必須以 root 使用者身分登入並輸入:
chown root:root /tmp
chmod 1777 /tmp
測試一下
/etc/init.d/mysqld 啟動
答案2
> [ERROR] InnoDB: Unable to create temporary file; errno: 13
這條線看起來有問題。嘗試檢查/tmp
dir 是否存在(應該存在)並且可供 mysql 使用者(或您使用的使用者)使用。您可以嘗試使用不同的路徑--tmpdir
或配置中的選項,更多信息在文件中)。
SELinux 也可能有問題(如果它處於強制模式)。ausearch -ts today -m avc | audit2allow
如果 /tmp dir 沒有被 mysql 阻止,請檢查您的審核日誌(例如,使用)。對於測試,您可以使用 停用 SELinux setenforce 0
。