旋转mysql慢查询日志 [英] rotating mysql slow query log
问题描述
我的服务器的MySQL慢查询日志每天都在增长(现在为37 MB),因此我想对其进行轮换.如果我将当前的日志文件移动到另一个文件夹,那么MySQL会自动创建另一个日志文件吗?就像我要删除当前的日志文件一样,所以当另一个慢速查询到来时,MySQL会自动创建一个新的日志文件吗?
My server's MySQL slow query log is growing day by day (37 MB now) so I want to rotate it. If I move current log file to another folder then will MySQL automatically create another log file? Think of it like I am deleting current log file, so will MySQL automatically create a new one when another slow query comes?
谢谢
推荐答案
您可以使用logrotate
脚本定期轮换MySQL日志,并可能保留有限数量的先前日志(以节省空间).您可以按照自己喜欢的时间表进行配置.
You can use logrotate
script to periodically rotate MySQL logs, and possibly keep a limited number of previous logs (to save space). You can configure it with any schedule you like.
我个人认为,使用 Webmin GUI
Personally, I found it easy to configure using Webmin GUI
这篇关于旋转mysql慢查询日志的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!