- Enable binary logging and set the server_id. Open the MySQL config file in your favorite editor and append the following lines. Choose server_id such that it will be unique to each MySQL server in your infrastructure. You can also simply put the log_bin variable in my.cnf without any value. In that case, the binary log is created in the data directory directory and uses hostname as its name.
shell> sudo vi /etc/my.cnf[mysqld]log_bin = /data/mysql/binlogs/server1server_id = 100
- Restart the MySQL server:
shell> sudo systemctl restart mysql
- Verify that binary logs are created:
mysql> SHOW VARIABLES LIKE 'log_bin%';+---------------------------------+-----------------------------------+| Variable_name | Value |+---------------------------------+-----------------------------------+ ...