2016-03-24 80 views
4

我在從源代碼編譯安裝後嘗試啓動mysql服務器時遇到了MAC OS X 10.11中的錯誤。 keyring_file不可讀。編譯後MySQL v5.7.11安裝時出錯

我試圖用下面的命令啓動服務器。

./mysqld start 

終端產生以下錯誤。

2016-03-24T18:43:50.591772Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details). 
2016-03-24T18:43:50.592053Z 0 [Warning] Insecure configuration for --secure-file-priv: Current value does not restrict location of generated files. Consider setting it to a valid, non-empty path. 
2016-03-24T18:43:50.592091Z 0 [Note] ./mysqld (mysqld 5.7.11) starting as process 3470 ... 
2016-03-24T18:43:50.593833Z 0 [Warning] Can't create test file /usr/local/mysql/data/Hemens-MacBook-Pro-2.lower-test 
2016-03-24T18:43:50.593852Z 0 [Warning] Can't create test file /usr/local/mysql/data/Hemens-MacBook-Pro-2.lower-test 
2016-03-24T18:43:50.595428Z 0 [ERROR] Plugin keyring_file reported: 'keyring_file initialization failure. Please check if the keyring_file_data points to readable keyring file or keyring file can be created in the specified location. The keyring_file will stay unusable until correct path to the keyring file gets provided' 
2016-03-24T18:43:50.595860Z 0 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins 
2016-03-24T18:43:50.595866Z 0 [Note] InnoDB: Uses event mutexes 
2016-03-24T18:43:50.595881Z 0 [Note] InnoDB: GCC builtin __atomic_thread_fence() is used for memory barrier 
2016-03-24T18:43:50.595884Z 0 [Note] InnoDB: Compressed tables use zlib 1.2.3 
2016-03-24T18:43:50.596157Z 0 [Note] InnoDB: Number of pools: 1 
2016-03-24T18:43:50.596319Z 0 [Note] InnoDB: Using CPU crc32 instructions 
2016-03-24T18:43:50.605257Z 0 [Note] InnoDB: Initializing buffer pool, total size = 128M, instances = 1, chunk size = 128M 
2016-03-24T18:43:50.615154Z 0 [Note] InnoDB: Completed initialization of buffer pool 
2016-03-24T18:43:50.631296Z 0 [Note] InnoDB: Highest supported file format is Barracuda. 
2016-03-24T18:43:50.638315Z 0 [Note] InnoDB: Creating shared tablespace for temporary tables 
2016-03-24T18:43:50.638358Z 0 [ERROR] InnoDB: Operating system error number 13 in a file operation. 
2016-03-24T18:43:50.638364Z 0 [ERROR] InnoDB: The error means mysqld does not have the access rights to the directory. 
2016-03-24T18:43:50.638369Z 0 [ERROR] InnoDB: Operating system error number 13 in a file operation. 
2016-03-24T18:43:50.638373Z 0 [ERROR] InnoDB: The error means mysqld does not have the access rights to the directory. 
2016-03-24T18:43:50.638377Z 0 [ERROR] InnoDB: Cannot open datafile './ibtmp1' 
2016-03-24T18:43:50.638381Z 0 [ERROR] InnoDB: Unable to create the shared innodb_temporary 
2016-03-24T18:43:50.638385Z 0 [ERROR] InnoDB: Plugin initialization aborted with error Cannot open a file 
2016-03-24T18:43:50.954042Z 0 [ERROR] Plugin 'InnoDB' init function returned error. 
2016-03-24T18:43:50.954098Z 0 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed. 
2016-03-24T18:43:50.954119Z 0 [ERROR] Failed to initialize plugins. 
2016-03-24T18:43:50.954126Z 0 [ERROR] Aborting 

2016-03-24T18:43:50.954141Z 0 [Note] Binlog end 
2016-03-24T18:43:50.954223Z 0 [Note] Shutting down plugin 'CSV' 
2016-03-24T18:43:50.954232Z 0 [Note] Shutting down plugin 'keyring_file' 
2016-03-24T18:43:50.954507Z 0 [Note] ./mysqld: Shutdown complete 

回答

2

如果檢查keyring_file_data mysql manual entry你會看到什麼這個選項的意思是:

由 keyring_file插件用於安全數據存儲中的數據文件的路徑名。文件位置應該在考慮僅供keyring_file插件使用的目錄 中。例如, 未找到數據目錄下的文件。

不要對多個MySQL 實例使用相同的keyring_file數據文件。每個實例都應該有自己獨特的數據文件。

默認文件名是密鑰環,位於目錄中,該目錄爲 特定於平臺,並取決於INSTALL_LAYOUT CMake 選項的值,如下表所示。要從源代碼構建文件時明確指定文件的默認目錄 ,請使用INSTALL_MYSQLKEYRINGDIR CMake選項 。

您還會看到各種Linux發行版處理它的默認值。

/var/lib/mysql-keyring/keyring

所以答案應該是安全的忽視。但是,如果你希望innodb文件加密my.cnf應該看起來像這樣:

[mysqld] 
keyring_file_data = /var/lib/mysql-keyring/keyring 

但是,這可能不會解決您的問題。

  1. 這是一個不屬於stackoverflow但可能serverfault的問題。
  2. 這是一個權限問題。你是否將MySQL數據目錄chown到正在運行的用戶mysqld下?