今天莫名Mysql出了点问题,然后使用brew install mysql,重装了一下Mysql,结果发现root登录不进去,报错:
2016-06-24T15:14:35.097091Z 0 [Warning] Failed to open optimizer cost constant tables
2016-06-24T15:14:35.098823Z 0 [Warning] System table 'time_zone_leap_second' is expected to be transactional.
2016-06-24T15:14:35.098835Z 0 [Warning] System table 'time_zone_name' is expected to be transactional.
2016-06-24T15:14:35.098839Z 0 [Warning] System table 'time_zone' is expected to be transactional.
2016-06-24T15:14:35.098842Z 0 [Warning] System table 'time_zone_transition_type' is expected to be transactional.
2016-06-24T15:14:35.098845Z 0 [Warning] System table 'time_zone_transition' is expected to be transactional.
google了一下,发现应该是brew自动帮我把mysql升级到了5.7,原来的数据库文件还是5.6导致的问题。解决的办法也很简单,记录一下供大家参考:
mysqld_safe --skip-grant-tables & #安全模式启动mysql服务
mysql_upgrade #升级
接着巴拉巴拉一大堆输出ok,表示升级成功。
然后最后修改一下root密码,重启mysql就可以了。
网友评论