The master-data parameter for manual synchronization of master/slave databases is often used when a slave database is created, because this is a relatively useful parameter, the default value is 1, by default, the statement contains change master to, which contains the start position of the file and position records. When the master-data = 2, The mysqldump file contains the change master to Statement, which is in the commented state and dump the file.
[Root @ aeolus1 c_learn] # mysqldump-uroot test -- single-transaction -- master-data = 2> the master-data. SQL filters out the change master to information [root @ aeolus1 c_learn] # grep-I" change master to "master-data. SQL -- CHANGE MASTER TO MASTER_LOG_FILE = 'mysql-bin.000012 ', MASTER_LOG_POS = 107;
Then modify
change master to master_host='xx.xx.xx.xx',master_user='repl',master_password='repl',master_port=3306,master_log_file='mysql-bin.000012',master_log_pos=107;
Then run the slave command from the database.
mysql> change master to master_host='xx.xx.xx.xx',master_user='repl',master_password='repl',master_port=3306,master_log_file='mysql-bin.000012',master_log_pos=107;
Then
mysql>start slave
Execute again
mysql>show slave status;
Note: If you have configured the server connection and password before, the slave server does not need to reset slave, directly
CHANGE MASTER TO MASTER_LOG_FILE='mysql-bin.000012', MASTER_LOG_POS=107;
You can.