Binary log error in mysql

后端 未结 8 1449
后悔当初
后悔当初 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.

    0 讨论(0)
  • 2021-01-03 01:37

    FWIW, I had the same issue after I tried to set up my.cnf.master and my.cnf.slave files and symlink them to my.cnf for master and slave, respectively. The idea was to be able to switch the machine from master to slave and back easily.

    It turned out that mysqld simply did not handle the symlink as expected. Hard-linking the file worked (ln my.cnf.master my.cnf). Careful if you do something like this, as overwriting one of the hard-linked filenames could break the link and create two separate files instead (depending on the method of rewriting employed by the software you use for it).

    0 讨论(0)
提交回复
热议问题