0x01 事由
準備在本地搭建一個完整的平臺,在本地調(diào)試可能比較方便些,我可以做些定制化的修改。結(jié)果發(fā)現(xiàn),本地搭建環(huán)境會有很多坑爹的問題,各種坑,一路需要摸索著來。
0x02 坑爹的錯誤
我抱著絕對順利的心,啟動服務程序,結(jié)果發(fā)現(xiàn),坑爹,根本啟動不了,完全懵逼不清楚情況。
異常截圖
以前明明可以用,現(xiàn)在居然啟動失敗了,我擦。二臉懵逼,咋整呢?想了兩個方案,一個是在vm虛擬機下面搭建一個新的環(huán)境,第二個是在本地重新裝mysql,這樣速度最快,我也可以省事,畢竟時間挺重要的。
0x03 沉下心研究
對于一個對技術(shù)有執(zhí)著有想法的人,明顯這兩個方案都不靠譜,辣么,只有自己研究看怎么解決問題了。首先,我翻看了下mysql錯誤日志,默認情況下在:
/usr/local/var/mysql/
當然,這是我的默認路徑,對于你們自己的我就不清楚了。翻看的時候發(fā)現(xiàn)有一些提示,具體如下:
2016-09-22T02:32:12.6NZ mysqld_safe mysqld from pid file /usr/local/var/mysql/smartdeMacBook-Pro.local.pid ended
2016-09-22T02:32:18.6NZ mysqld_safe Starting mysqld daemon with databases from /usr/local/var/mysql
2016-09-22T02:32:18.376587Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2016-09-22T02:32:18.376823Z 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-09-22T02:32:18.376876Z 0 [Note] /usr/local/Cellar/mysql/5.7.11/bin/mysqld (mysqld 5.7.11) starting as process 12105 ...
2016-09-22T02:32:18.378901Z 0 [Warning] Setting lower_case_table_names=2 because file system for /usr/local/var/mysql/ is case insensitive
2016-09-22T02:32:18.381559Z 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-09-22T02:32:18.382012Z 0 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2016-09-22T02:32:18.382020Z 0 [Note] InnoDB: Uses event mutexes
2016-09-22T02:32:18.382026Z 0 [Note] InnoDB: GCC builtin __atomic_thread_fence() is used for memory barrier
2016-09-22T02:32:18.382030Z 0 [Note] InnoDB: Compressed tables use zlib 1.2.3
2016-09-22T02:32:18.382287Z 0 [Note] InnoDB: Number of pools: 1
2016-09-22T02:32:18.382413Z 0 [Note] InnoDB: Using CPU crc32 instructions
2016-09-22T02:32:18.393076Z 0 [Note] InnoDB: Initializing buffer pool, total size = 128M, instances = 1, chunk size = 128M
2016-09-22T02:32:18.404055Z 0 [Note] InnoDB: Completed initialization of buffer pool
2016-09-22T02:32:18.417431Z 0 [ERROR] InnoDB: The innodb_system data file 'ibdata1' must be writable
2016-09-22T02:32:18.417475Z 0 [ERROR] InnoDB: The innodb_system data file 'ibdata1' must be writable
2016-09-22T02:32:18.417541Z 0 [ERROR] InnoDB: Plugin initialization aborted with error Generic error
2016-09-22T02:32:18.733064Z 0 [ERROR] Plugin 'InnoDB' init function returned error.
2016-09-22T02:32:18.733113Z 0 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
2016-09-22T02:32:18.733132Z 0 [ERROR] Failed to initialize plugins.
2016-09-22T02:32:18.733142Z 0 [ERROR] Aborting
2016-09-22T02:32:18.733160Z 0 [Note] Binlog end
2016-09-22T02:32:18.733256Z 0 [Note] Shutting down plugin 'CSV'
2016-09-22T02:32:18.733274Z 0 [Note] Shutting down plugin 'keyring_file'
2016-09-22T02:32:18.733969Z 0 [Note] /usr/local/Cellar/mysql/5.7.11/bin/mysqld: Shutdown complete
2016-09-22T02:32:18.6NZ mysqld_safe mysqld from pid file /usr/local/var/mysql/smartdeMacBook-Pro.local.pid ended
抓住最后一個tips,去搜索下了,發(fā)現(xiàn)有很多說法,在gg上找到不少的結(jié)局方式,基本都不好使。諸如以下:
網(wǎng)上搜索的結(jié)果
坑爹啊。。。后來朋友說了一句,會不會是權(quán)限啊?我就納悶了,試了一下,居然狗日的成功了。。。
解決問題
0x04 結(jié)語
碰到問題不要先重裝,或許你這次重裝后,下次還會遇到類似的問題,到那個時候就真心悲劇了。最好的辦法就是手動嘗試解決下,說不定會有更好的結(jié)果。