MAC OS 下坑爹的Mysql故障

0x01 事由


准备在本地搭建一个完整的平台,在本地调试可能比较方便些,我可以做些定制化的修改。结果发现,本地搭建环境会有很多坑爹的问题,各种坑,一路需要摸索着来。

0x02 坑爹的错误


我抱着绝对顺利的心,启动服务程序,结果发现,坑爹,根本启动不了,完全懵逼不清楚情况。


异常截图

以前明明可以用,现在居然启动失败了,我擦。二脸懵逼,咋整呢?想了两个方案,一个是在vm虚拟机下面搭建一个新的环境,第二个是在本地重新装mysql,这样速度最快,我也可以省事,毕竟时间挺重要的。

0x03 沉下心研究


对于一个对技术有执着有想法的人,明显这两个方案都不靠谱,辣么,只有自己研究看怎么解决问题了。首先,我翻看了下mysql错误日志,默认情况下在:

  /usr/local/var/mysql/

当然,这是我的默认路径,对于你们自己的我就不清楚了。翻看的时候发现有一些提示,具体如下:

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,去搜索下了,发现有很多说法,在gg上找到不少的结局方式,基本都不好使。诸如以下:

网上搜索的结果

坑爹啊。。。后来朋友说了一句,会不会是权限啊?我就纳闷了,试了一下,居然狗日的成功了。。。

解决问题

0x04 结语


碰到问题不要先重装,或许你这次重装后,下次还会遇到类似的问题,到那个时候就真心悲剧了。最好的办法就是手动尝试解决下,说不定会有更好的结果。

你可能感兴趣的:(MAC OS 下坑爹的Mysql故障)