Fix to modify hostname causes MySQL restart slave failed
(This happens only in the case where the slave information is present in the file, if there is no such problem in the table):
Sometimes we change the host name very early, after running for several months, suddenly system problems, restart the database, found that start slave not come. The Relay-log file name and offset are not found.
Workaround:
> Show Slave status\g Note the current execution to the Binlog filename of the Master and Binlog Pos:
1. Row ***************************
Slave_io_state:waiting for Master to send event
master_host:10.0.21.66
Master_user:rpl
master_port:3306
master_log_file:mysql-bin.000308
exec_master_log_pos:169761782
Then execute:
> Reset slave all;
Re-execute Change master:
> Change MASTER to
Master_host= ' 10.0.21.66 ',
Master_user= ' RPL ',
Master_password= ' RPL ',
master_port=3306,
Master_log_file= ' mysql-bin.000308 ',
master_log_pos=169761782;
Start slave:
> Start slave;
> Show Slave status\g
# # # # To avoid this, we just need to configure it in MY.CNF before we configure it from the library
Master_info_repository = TABLE
Relay_log_info_repository = TABLE
Relay_log_recovery = 1
Restart the database, and then configure Change master.
This article is from the "Vegetable Chicken" blog, please be sure to keep this source http://lee90.blog.51cto.com/10414478/1932684
Fix to modify hostname causes MySQL restart slave failed