记一次启动 MySQL 报错

时间:2025-02-13 14:55:52

记一次启动 MySQL 报错

  • 使用 brew services start mysql 命令启动,发现无法连接
  • 使用 ps aux|grep mysql 命令查看,没有进程在运行,启动失败了
  • 使用 start 命令启动,报错:
$  start
Starting MySQL
. ERROR! The server quit without updating PID file (/usr/local/var/mysql/).
  • 查看 /usr/local/var/mysql/ 目录,发现 文件(xxx 是当前的系统用户名),包含如下错误日志:
2020-11-20T14:33:05.145542Z 1 [ERROR] [MY-012526] [InnoDB] Upgrade after a crash is not supported. This redo log was created with MySQL 5.7.20. Please follow the instructions at /doc/refman/8.0/en/
2020-11-20T14:33:05.145683Z 1 [ERROR] [MY-012930] [InnoDB] Plugin initialization aborted with error Generic error.
2020-11-20T14:33:05.146296Z 1 [ERROR] [MY-011013] [Server] Failed to initialize DD Storage Engine.
2020-11-20T14:33:05.146669Z 0 [ERROR] [MY-010020] [Server] Data Dictionary initialization failed.
2020-11-20T14:33:05.146892Z 0 [ERROR] [MY-010119] [Server] Aborting
  • 解决方式:备份(或者移除)/usr/local/var/mysql 目录下的两个文件
    • ib_logfile0
    • ib_logfile1
    • 参考链接:/weixin_40083227/article/details/108475373
$ mv ib_logfile0 ib_logfile0_backup
$ mv ib_logfile1 ib_logfile1_backup