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)

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.