MySQL Replication Using GTID

MySQLreplication

I want to create MySQL replication using GTID.

According to MySQL Manual I need the following settings in my.cnf (for the master)

server-id       = 1
log_bin         = /var/log/mysql/mysql-bin.log
gtid_mode = ON
log-slave-updates
enforce-gtid-consistency

I have also seen this guide, which suggests the following settings in my.cnf (for master):

log-bin = mysql-bin
server-id = 1
relay-log = relay-log-slave
gtid-mode =ON
enforce-gtid-consistency
binlog_format = MIXED
log_slave_updates

Questions:

  1. I have noticed that underscore and dash are being used loosely in the documents, for example when I installed MySQL on my computer, the variable name is log_bin but in MySQL manual they are using log-bin. Are _ and – interchangeable?

  2. In the second tutorial that I have linked they are setting these two values in addition to setting values from MySQL manual: relay-log = relay-log-slave and relay-log = relay-log-slave. What are these two settings? And do I need them?

Best Answer

_ and - are interchangeable in configuration files, however as SQL system variables only _ is supported.

relay-log is a variable. relay-log-slave is just a value string.