How can I turn off Binary Logging?

What issue or error are you experiencing?

Binary Logging is creating huge amounts of data at one point it was up to 50GB! I have tried to add a disable-log-bin to my.cnf but it gets overwritten on startup. How do I stop this???


What steps can be taken to replicate the issue? Feel free to include screenshots, videos, etc


System Details

  • Local Version:
    Version 9.1.1+6738

  • Operating System (OS) and OS version:
    Mac OS 15.1.1 (24B91)


Local Logs

Attach your Local Logs here (Help Doc - Retrieving Local’s Log)


Security Reminder
Local does a pretty good job of scrubbing private info from the logs and the errors it produces, however there’s always the possibility that something private can come through. Because these are public forums, always review the screenshots you are sharing to make sure there isn’t private info like passwords being displayed.

Hey @pandabrand! Do you have a lot of sites in Local or a site or sites that you’ve had in the app for a long time?

There was some discussion around this in a recent thread below with some workarounds provided by @emmtre

I do have a number of sites in Local and one in particular had a number of bin logs. I purged them with PURGE BINARY LOGS BEFORE NOW(); but I would like to just turn it off so I don’t have to worry about this in dev. But where do y’all store the my.cnf.hbs file? it doesn’t seem to be in Application Support/Local?

I really need to turn this off it grows to 1GB in a matter of minutes! I don’t need this for dev!

I have found the my.cnf.hbs in lightning-services but that doesn’t seem to have any impact on the cnf in this site.

Hey @pandabrand – The various config files for each site are located near the site folders. So for example, the MySQL one is located at:

~/Local Sites/<site-name>/conf/mysql/my.cnf.hbs

You can quickly get there by clicking the “Site folder” link in Local and navigating from there:

After editing that file, you’ll need to restart the site in Local so that it can re-compile the config and restart the process.
Can you give that a try and let us know how it goes?

2 Likes

Thank you that’s it!

@pandabrand @ben.turner @Nick-B

Instead of turning off the binary logging entirely in MySQL 8 with disable-log-bin you can also set the max_binlog_size and binlog_expire_logs_seconds variables to some minimal values to reduce the binary log size significantly but still keep some data integrity and recovery operations.

max_binlog_size = 4096
binlog_expire_logs_seconds = 60

https://dev.mysql.com/doc/refman/8.0/en/replication-options-binary-log.html#sysvar_max_binlog_size

https://dev.mysql.com/doc/refman/8.0/en/replication-options-binary-log.html#sysvar_binlog_expire_logs_seconds

3 Likes

Thanks for this info and the links to the docs @emmtre !

Honestly, I’ve never dug too deeply into MySQL’s binary log options.

Am I right in thinking that bin logs are mostly used in production environments as a way to replicate changes from primary to secondary dbs as well as a sort of backup and audit feature if things go wrong?

If so, would it make sense to disable binary logs in Local since it’s a dev environment? Or is there some additional features of MySQL bin logs that are useful when developing?

1 Like

@ben.turner

That’s my understanding as well but I’m not an expert in this area. I’ve been told it’s better to set some smaller values for the other variables instead of turning off the logging completely but I don’t know for sure. Since the size of the binary logs might be a big problem I think this should be changed in the default my.cnf.hbs config file for MySQL 8 in a future update. But I think you need to consult a MySQL 8 expert or someone with more knowledge about this since it is such a critical decision. I have been running with the variables and values I posted above and so far it has been fine without any issues that I have noticed but it needs to be validated.

1 Like