Content: |
[mysqladmin] |
password = <password> |
Change the access permissions
chmod 600 /root/.my.cnf
Create mysql file under /etc/logrotate.d (Or edit file if exists)
vim /etc/logrotate.d/mysql
Content:
/var/log/mysqld/*.log {
# create 600 mysql mysql
notifempty
daily
rotate 30
missingok
compress
postrotate
# just if mysqld is really running
if test -x /usr/bin/mysqladmin && \
/usr/bin/mysqladmin ping &>/dev/null
then
/usr/bin/mysqladmin flush-general-log flush-slow-log flush-error-log
fi
endscript
}
Debug:
logrotate -df /etc/logrotate.d/mysql
Try:
logrotate -df /etc/logrotate.d/mysql
Ref:
- https://lalitvc.wordpress.com/2017/02/08/mysql-server-log-maintenance/
- https://serverfault.com/questions/415774/mysql-doesnt-logs-error-to-new-file-after-rotating
- https://gist.github.com/inouetakuya/5201747
No comments:
Post a Comment