0x01 事由
準(zhǔn)備在本地搭建一個(gè)完整的平臺(tái),在本地調(diào)試可能比較方便些检疫,我可以做些定制化的修改。結(jié)果發(fā)現(xiàn)祷嘶,本地搭建環(huán)境會(huì)有很多坑爹的問題屎媳,各種坑,一路需要摸索著來(lái)论巍。
0x02 坑爹的錯(cuò)誤
我抱著絕對(duì)順利的心烛谊,啟動(dòng)服務(wù)程序,結(jié)果發(fā)現(xiàn)嘉汰,坑爹丹禀,根本啟動(dòng)不了,完全懵逼不清楚情況。
以前明明可以用湃崩,現(xiàn)在居然啟動(dòng)失敗了,我擦接箫。二臉懵逼攒读,咋整呢?想了兩個(gè)方案辛友,一個(gè)是在vm虛擬機(jī)下面搭建一個(gè)新的環(huán)境薄扁,第二個(gè)是在本地重新裝mysql,這樣速度最快揍瑟,我也可以省事十饥,畢竟時(shí)間挺重要的蚀之。
0x03 沉下心研究
對(duì)于一個(gè)對(duì)技術(shù)有執(zhí)著有想法的人,明顯這兩個(gè)方案都不靠譜日缨,辣么,只有自己研究看怎么解決問題了掖看。首先匣距,我翻看了下mysql錯(cuò)誤日志,默認(rèn)情況下在:
/usr/local/var/mysql/
當(dāng)然哎壳,這是我的默認(rèn)路徑毅待,對(duì)于你們自己的我就不清楚了。翻看的時(shí)候發(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
抓住最后一個(gè)tips尸红,去搜索下了,發(fā)現(xiàn)有很多說(shuō)法刹泄,在gg上找到不少的結(jié)局方式外里,基本都不好使。諸如以下:
坑爹啊特石。级乐。。后來(lái)朋友說(shuō)了一句县匠,會(huì)不會(huì)是權(quán)限胺缈啤?我就納悶了乞旦,試了一下贼穆,居然狗日的成功了。兰粉。故痊。
0x04 結(jié)語(yǔ)
碰到問題不要先重裝,或許你這次重裝后玖姑,下次還會(huì)遇到類似的問題愕秫,到那個(gè)時(shí)候就真心悲劇了慨菱。最好的辦法就是手動(dòng)嘗試解決下,說(shuō)不定會(huì)有更好的結(jié)果戴甩。