macOS 断电关机后 mysql 无法启动
mysql 版本为 8.0,通过 brew install mysql
安装
查看错误日志,发现如下错误
2022-01-08T01:50:12.256198Z 1 [ERROR] [MY-012224] [InnoDB] Checksum mismatch in datafile: ./undo_002, Space ID:4294967278, Flags: 0. Please refer to http://dev.mysql.com/doc/refman/8.0/en/innodb-troubleshooting-datadict.html for how to resolve the issue.
2022-01-08T01:50:12.277271Z 1 [ERROR] [MY-012224] [InnoDB] Checksum mismatch in datafile: ./undo_002, Space ID:4294967278, Flags: 0. Please refer to http://dev.mysql.com/doc/refman/8.0/en/innodb-troubleshooting-datadict.html for how to resolve the issue.
解决方法
进入 mysql 数据目录,删除 undo 开头文件
为了数据安全,请先备份 /usr/local/var/mysql 数据
cd /usr/local/var/mysql
rm -f undo_00*