EtC
MySQL Binary Log 삭제
freecatz
2021. 11. 23. 08:46
1. 바이너리 로그 확인
mysql> show binary logs;
2. 바이너리 로그 삭제
mysql> purge binary logs to 'binlog.000002';
참고 : binlog.000002 이전의 바이너리 로그가 삭제 된다.
아래와 같이 특정 일자 이전의 로그를 삭제 하는 방법도 있다고 한다.
PURGE BINARY LOGS BEFORE '2021-01-01 11:59:59';
3. 바이너리 로그 삭제 확인
root@freecatz-mysql:~# ls -al /var/lib/mysql/binlog.*
4. 기타
mysql 설정 파일의 'expire_logs_days' 가 'binlog_expire_logs_seconds' 로 변경 되었다고 한다.
mysql> show global variables like 'expire_logs_days';
mysql> show global variables like 'binlog_expire_logs_seconds';
* 2592000 = 30일