10
10

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

バイナリログの削除

Last updated at Posted at 2014-06-15

DB:MariaDB 10.0.11

#自動
設定ファイルに何日で削除するか記述する
defaultは0で自動削除はしない。設定値は0-99
https://mariadb.com/kb/en/server-system-variables/#expire_logs_days

my.cnf
expire_logs_days=2

#手動
PURGE MASTER LOGS構文を使う
この構文で削除するとbin-logのインデックスも適切に修正してくれる

$ cat mysql-bin.index 
./mysql-bin.000024
./mysql-bin.000025
./mysql-bin.000026
./mysql-bin.000027
./mysql-bin.000028
./mysql-bin.000029
./mysql-bin.000030
./mysql-bin.000031
./mysql-bin.000032
./mysql-bin.000033
./mysql-bin.000034

MariaDB [(none)]> PURGE MASTER LOGS BEFORE '2014-06-15 05:00:00';
Query OK, 0 rows affected (0.04 sec)

$ cat mysql-bin.index 
./mysql-bin.000034

rmとかでlogだけ消した場合はbin-logのindexが修正されないので次回起動時にエラーになるので注意

10
10
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
10
10

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?