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

mysql的general log太大怎么處理

mysql的general log太大怎么處理

回答
編輯回答
礙你眼

可以通過(guò)Logrotate將日志每天定時(shí)進(jìn)行切割。
需要維護(hù)如下的一份配置文件:

/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