首页 > 解决方案 > 无法让 Mysql 8.0 在 Mac OS 中保持打开状态

问题描述

MySQL突然无法保持打开状态。我试过 ps -ef | grep mysql sudo kill -9 5211

我尝试删除我的 my.cnf 我尝试按照上一篇文章的建议创建一个新的 my.cnf

没有任何工作。输入密码后,“系统偏好设置”中的 mySQL 会打开,几秒钟后会关闭。

这是错误日志:

2019-02-14T01:13:17.285925Z 0 [System] [MY-010116] [Server] /usr/local/Cellar/mysql/8.0.12/bin/mysqld (mysqld 8.0.12) starting as process 11402

 2019-02-14T01:13:17.288972Z 0 [Warning] [MY-010159] [Server] Setting lower_case_table_names=2 because file system for /usr/local/var/mysql/ is case insensitive

 2019-02-14T01:13:17.317235Z 1 [ERROR] [MY-012592] [InnoDB] InnoDB: Operating system error number 2 in a file operation.
2019-02-14T01:13:17.317441Z 1 [ERROR] [MY-012593] [InnoDB] InnoDB: The error means the system cannot find the path specified.
2019-02-14T01:13:17.317548Z 1 [ERROR] [MY-012594] [InnoDB] InnoDB: If you are  installing InnoDB, remember that you must create directories yourself, InnoDB does not create them.
 2019-02-14T01:13:17.317666Z 1 [ERROR] [MY-012646] [InnoDB] InnoDB: File ./ibdata1: 'open' returned OS error 71. Cannot continue operation
 2019-02-14T01:13:17.317798Z 1 [ERROR] [MY-012981] [InnoDB] InnoDB: Cannot continue operation.
 2019-02-14T01:15:15.776723Z 0 [System] [MY-010116] [Server] /usr/local/Cellar/mysql/8.0.12/bin/mysqld (mysqld 8.0.12) starting as process 12646
 2019-02-14T01:15:15.779642Z 0 [Warning] [MY-010159] [Server] Setting lower_case_table_names=2 because file system for /usr/local/var/mysql/ is case insensitive
  2019-02-14T01:15:15.796296Z 1 [ERROR] [MY-012592] [InnoDB] InnoDB: Operating system error number 2 in a file operation.
  2019-02-14T01:15:15.796337Z 1 [ERROR] [MY-012593] [InnoDB] InnoDB: The error means the system cannot find the path specified.
   2019-02-14T01:15:15.796352Z 1 [ERROR] [MY-012594] [InnoDB] InnoDB: If you are installing InnoDB, remember that you must create directories yourself, InnoDB does not create them.
   2019-02-14T01:15:15.796365Z 1 [ERROR] [MY-012646] [InnoDB] InnoDB: File ./ibdata1: 'open' returned OS error 71. Cannot continue operation
   2019-02-14T01:15:15.796380Z 1 [ERROR] [MY-012981] [InnoDB] InnoDB: Cannot continue operation.

这是错误。我会检查它的含义。

标签: mysqlmacos

解决方案


由于您已删除 .cnf 文件,因此在当前文件夹中需要 ./ibdata1 文件,但它不存在。通常数据目录定义在带有datadir属性的 .cnf 文件中。例如

datadir=/var/lib/mysql

这个 ibdata1 在 datadir 文件夹中。


推荐阅读