Binary log error in mysql

后端 未结 8 1450
后悔当初
后悔当初 2021-01-03 00:41

When I am trying to check binary log:

 SHOW BINARY LOGS;

I get this error:

ERROR 1381 (HY000): You are not using bin

8条回答
  •  小鲜肉
    小鲜肉 (楼主)
    2021-01-03 01:37

    Set the log-bin variable in your MySQL configuration file, then restart MySQL.

    An example my.cnf (on Linux/unix) or my.ini (on Windows) would look like:

    [client]
    ...
    
    [mysqld]
    ...
    log-bin=mysql-bin
    ---
    

    Once restarted, MySQL automatically creates a new binary log (does so upon every restart). You may also wish to look at the following variables:

    server-id        = 1
    expire_logs_days = 4
    sync_binlog      = 1
    

    Read details on the MySQL documentation. If you're after replication setup (a primary reason for using binary logs), check out Replication configuration checklist.

提交回复
热议问题