Below is a short tutorial on how to enable binary log in Linux.
- Locate the configuration file of MySQL Server my.cnf or mysql.cnf
As a rule, this file is located along the path:
/etc/mysql.cnf
or
/etc/my.cnf
If you cannot find it, please use the following command:
sudo find / -type f -name mysql.cnf
- Edit the configuration file of MySQL
Run:
sudo nano /etc/mysql.cnf
and add the following text to the end of the file:
[mysqld] server-id = 1 expire_logs_days = 10 binlog_format = row log_bin = /var/log/mysql/mysql-bin.log
- Restart MySQL Server
sudo service mysql restart
Enable the binary log file via SqlBak
If SqlBak is installed on your server and a connection is established to your MySQL Server, then you can enable binary logs via one command:
sudo sqlbak —configure-mysql —connection-id=1
If you have set several connections, then in the –connection-id parameter, you have to specify the connection ID to the database for which you want to enable binary logs. To find the connection ID, use the following command:
sudo sqlbak -sc