4

I have a lot of small binary log files , each of them just only 126 Bytes

-rw-rw----. 1 mysql mysql  126 Jan  6 16:13 mysql-bin.000001
-rw-rw----. 1 mysql mysql  126 Jan  6 16:16 mysql-bin.000002
-rw-rw----. 1 mysql mysql  150 Jan  7 10:34 mysql-bin.000003
-rw-rw----. 1 mysql mysql  126 Jan  8 09:57 mysql-bin.000004
-rw-rw----. 1 mysql mysql  126 Jan  8 11:08 mysql-bin.000005
-rw-rw----. 1 mysql mysql  107 Jan  8 11:09 mysql-bin.000006
-rw-rw----. 1 mysql mysql  126 Jan  8 13:21 mysql-bin.000007
-rw-rw----. 1 mysql mysql  342 Jan  8 16:25 mysql-bin.index

how to let them grow bigger? and my "binlog_cache_size" is more than 126 Byte

mysql> show variables like 'binlog_cache_size';
ERROR 2006 (HY000): MySQL server has gone away
No connection. Trying to reconnect...
Connection id:    1
Current database: test

+-------------------+-------+
| Variable_name     | Value |
+-------------------+-------+
| binlog_cache_size | 32768 |
+-------------------+-------+
1 row in set (0.00 sec)

can anybody tell me why(⊙ˍ⊙) ? thank you very much :)

mysql logging

LawrenceLi
  • 321
  • 3
  • 15

1 Answers1

2

Is your MySQL Server restarting? Check your uptime:

SHOW GLOBAL STATUS LIKE 'uptime';

The binary log gets closed at shutdown, and a new binary log created at startup. The fact that you get "MySQL server has gone away" while querying above might also suggest the server restarted.

  • 1
    Also check `SHOW GLOBAL STATUS LIKE 'Com_flush%';` -- It could be that something is calling `FLUSH LOGS`. The restarts are awfully frequent. – Rick James Jan 09 '16 at 17:37
  • 1
    "server has gone away" usually means that the _client_ timed out or the network dropped the connection. The binlog times imply something worse. – Rick James Jan 09 '16 at 17:38