Tag Archives: Flush logs

Change the binary logs file manually in MySQL

Change the binary logs file manually in MySQL

Check the current binary is using by MySQL

mysql> SHOW MASTER STATUS;

+-----------------------+----------+--------------+------------------+-------------------+
| File                  | Position | Binlog_Do_DB | Binlog_Ignore_DB | Executed_Gtid_Set |
+-----------------------+----------+--------------+------------------+-------------------+
| IXC1-MYSQL-bin.000004 |      155 |              |                  |                   |
+-----------------------+----------+--------------+------------------+-------------------+
1 row in set (0.00 sec)

Check the list of binary logs

mysql> SHOW BINARY LOGS;

+-----------------------+-----------+-----------+
| Log_name              | File_size | Encrypted |
+-----------------------+-----------+-----------+
| IXC1-MYSQL-bin.000001 |       178 | No        |
| IXC1-MYSQL-bin.000002 |      2209 | No        |
| IXC1-MYSQL-bin.000003 |     15635 | No        |
| IXC1-MYSQL-bin.000004 |       155 | No        |
+-----------------------+-----------+-----------+
4 rows in set (0.06 sec)

Manually Change the binary log or flush the changes

mysql> flush logs;
Query OK, 0 rows affected (0.87 sec)

Verified the current binary file

mysql> SHOW MASTER STATUS;

+-----------------------+----------+--------------+------------------+-------------------+
| File                  | Position | Binlog_Do_DB | Binlog_Ignore_DB | Executed_Gtid_Set |
+-----------------------+----------+--------------+------------------+-------------------+
| IXC1-MYSQL-bin.000005 |      155 |              |                  |                   |
+-----------------------+----------+--------------+------------------+-------------------+
1 row in set (0.00 sec)