MysqlでInnoDBが壊れた時にしたこと

Macにhomebrewでインストールしたmysqlを起動しようとするとエラーが出て起動できなかった模様。

ログを見てみる

tail -n 100 /usr/local/var/mysql/[マシン名].local.err

InnoDB: No valid checkpoint found.
InnoDB: If this error appears when you are creating an InnoDB database,
InnoDB: the problem may be that during an earlier attempt you managed
InnoDB: to create the InnoDB data files, but log file creation failed.
InnoDB: If that is the case, please refer to
InnoDB: http://dev.mysql.com/doc/refman/5.6/en/error-creating-innodb.html

念のため一旦停止

mysql.server stop

いらないファイルを削除

mv /usr/local/var/mysql/ib_logfile0
mv /usr/local/var/mysql/ib_logfile1
mv /usr/local/var/mysql/ibdata1

起動

mysql.server start

参考

https://forum.directadmin.com/showthread.php?t=25033