mysqlmy.cnfmysqlbinlog

how to prevent mysql from createing mysql-bin.00000x files?


I see that mysql creates a lot of files that are named like mysql-bin.000001, mysql-bin.000002, mysql-bin.000003 etc. I've found here that my log_bin setting is "ON". I'm wondering how I can set this to off and if that's a smart thing to do. I've tried this: set log_bin = "OFF"; but it resulted to this: ERROR 1238 (HY000): Variable 'log_bin' is a read only variable

On multiple websites I've found this solution and changed it in "/etc/my.cnf":

Disable MySQL binlogging

If you are not replicating, you can disable binlogging by changing your my.ini or my.cnf file. Open your my.ini or /etc/my.cnf (/etc/mysql/my.cnf), enter:

# vi /etc/my.cnf

Find a line that reads "log_bin" and remove or comment it as follows:

# log_bin = /var/log/mysql/mysql-bin.log

You also need to remove or comment following lines:

# expire_logs_days = 10

# max_binlog_size = 100M

Close and save the file.

Finally, restart mysql server:

# service mysql restart

But this doesn't seem to have any affect at all. As far as I could find, these files mainly exist for replication, but I'm not replicating anything.


Solution

  • Turned out that there was a setting server-id=1 that I had to remove. Problem is solved now.