How to Enable Binary Log in Linux

Below is the short tutorial on how to enable binary log in Linux.

1. Locate configuration file of MySQL Server

It is usually located here: /etc/mysql/mysql.cnf

It is possible that mysql.conf file itself will not contain configurations, but instead it may contain links to directories containing specialized configuration files. For example, in version 5.7, the file with the binary log configurations is located here: /etc/mysql/mysql.conf.d/mysqld.cnf

If you cannot locate mysql.cnf file, use the following command: find

sudo find / -type f -name mysql.cnf

2. Enable binary log

The configuration file must contain a [mysqld] section, most of the options in this section will be commented out (starting with a # character). Find the parameters server_id, log_bin, max_binlog_size, expire_logs_days, and uncomment them.After saving the file, you need to restart MySQL Server for the changes to take effect:

sudo service mysql restart

Leave a Reply

Your email address will not be published. Required fields are marked *