Mysql – Slave start to generate relay log files but not master server

MySQLreplication

I am settings up two new servers. One is the master and the other is the slave. Below is the config file for both.
Master DB

[mysqld]
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
user=mysql
# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0
innodb_file_per_table

server-id=1
binlog_do_db=data1


[mysqld_safe]
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid

Slave DB

[mysqld]
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
user=mysql
# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0
innodb_file_per_table


server-id=2
master-host = 202.*.*.*
master-user = replicationUser1
master-password = ********
master-port = 3306
replicate-do-db=data1



[mysqld_safe]
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid

So first in the master I run this reset master command it gave me this error. reset master;
ERROR 1186 (HY000): Binlog closed, cannot RESET MASTER. Then on the slave I first ran stop master then reset slave then start slave. THen I notice this files are generated in the slave master.info,mysqld-relay-bin.000001, mysqld-relay-bin.index and relay-log.info. In addition I have also ran this command on slave and it gave me no errors.

change master to MASTER_HOST='202.*.*.*', MASTER_USER='replicationUser1', MASTER_PASSWORD='******',

What should I do now I am quite stuck do not know how to move it next? Thank you.

Best Answer

You need a log-bin entry in your master my.cnf file

Per http://dev.mysql.com/doc/refman/5.0/en/binary-log.html


To enable the binary log, start the server with the --log-bin[=base_name] option. If no base_name value is given, the default name is the value of the pid-file option (which by default is the name of host machine) followed by -bin. If the basename is given, the server writes the file in the data directory unless the basename is given with a leading absolute path name to specify a different directory.


After setting the log-bin and restarting the master, you then can run RESET MASTER; and then SHOW MASTER STATUS; to get the correct values for your CHANGE MASTER command for your slave.