Recently upgraded to MySQL 5.7 and I am in the process of setting up binary log. I have enabled the binary log but I am not able to set the log_bin_basename and binary log path. It showing it is a global read only variable. I need to separate binary logs from data directory. How to edit the log_bin_basename?. After editing in configuration file, the server not starting. Thanks in advance.

enter image description here

enter image description here

  • Is this the Master? Or a Slave? Please show us the line(s) in my.cnf that you changed before it "not starting".
    – Rick James
    Aug 30, 2016 at 18:51
  • @Rick James - I have not yet started the replication in this server. It is a newly built testing server. In default, there was only log_bin commented, nothing else was there, I have been adding other variable configuration. Sep 1, 2016 at 6:40
  • If you are not capturing changes to the binlog, and you are writing to the Master, then the Slave will get out of sync.
    – Rick James
    Sep 1, 2016 at 18:35
  • Probably log_bin_basename can be set only in my.cnf, followed by a reset.
    – Rick James
    Sep 1, 2016 at 18:36

1 Answer 1


After, discussion with my colleagues, I found that, the log_bin_basename is read only variable and it took the value from the log-bin definition. So I added another variable log-bin, without modifying the default log_bin variable. Now the binary log enabled and basename pointed to the separate directory.

#log_bin # This is default
log-bin                       =       /logs/binlog/mysql-bin
log_bin_basename              =       /logs/binlog/mysql-bin
expire_logs_days              =       5
sync-binlog                   =       1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.