来源地址:https://blog.csdn.net/qq_21108311/article/details/107098810
问题:
MySQL5.6/5.7/8.0把慢日志mv迁移到其他路径后没有自动创建新的log文件,本地新建文件也无法打印慢日志
状态:
mysql实例运行正常,没有看到error log,慢日志配置正常,采集时间正常,范围正常;
解决:
再数据库上执行刷新操作,命令:
flush logs
原因:
需要刷新缓存
注意事项:
不需要重启数据库,不需要手动创建日志文件,刷新后mysql会自动创建日志文件,但是迁移后到执行刷新的这段时间的慢日志已丢失无法找回;
官方原文:
FLUSH LOGS
Closes and reopens any log file to which the server is writing. If binary logging is enabled, the sequence number of the binary log file is incremented by one relative to the previous file. If relay logging is enabled, the sequence number of the relay log file is incremented by one relative to the previous file.
地址:
https://dev.mysql.com/doc/refman/5.7/en/flush.html
————————————————
版权声明:本文为CSDN博主「布偶猫爸爸」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/qq_21108311/article/details/107098810