Preparing MySQL
The next step is to prepare your MySQL server by enabling the binary log. To do this, add the following parameters to the [mysqld]
section of your MySQL server’s configuration file (i.e., my.cnf
or my.ini
, depending on your system):
server-id = 888888
log_bin = /file_path/mysql-bin.log
expire_logs_days = 30
max_binlog_size = 1G
binlog_format = ROW
net_read_timeout = 3600
net_write_timeout = 3600
wait_timeout = 86400
replicate-wild-do-table = yourdb.%
log-slave-updates = TRUE
The value of log_bin
should be the path and name of the binary log file. For the server-id
, provide a unique number to identify it among databases that are replicated. It’s necessary to enable log-slave-updates
if the database server is a slave of another database.
Depending on your MySQL Server version, you may also need to add the following parameters.
log-bin-use-v1-row-events = TRUE
# MySQL Server 5.1.56-ndb-7-0-27, 5.1.56-ndb-7.1.16 or above
show_compatibility_56 = ON
#MySQL Server 5.7.1 or above
When you’re finished editing the MySQL configuration file, restart the MySQL daemon for the changes to take effect.