鍍金池/ 問答/數(shù)據(jù)庫/ mysql的general log太大怎么處理

mysql的general log太大怎么處理

mysql的general log太大怎么處理

回答
編輯回答
礙你眼

可以通過Logrotate將日志每天定時進行切割。
需要維護如下的一份配置文件:

/var/log/mysql/*.log {
  create 644 mysql mysql
  notifempty
  daily
  rotate 5
  missingok
  nocompress
  sharedscripts
  postrotate
  # run if mysqld is running
  if test -n "`ps acx|grep mysqld`"; then
    /usr/bin/mysqladmin flush-logs
  fi
  endscript
}
2017年12月21日 10:26