At times I’ve received this message when restarting a mysql slave server:
Could not initialize master info structure; more error messages can be found in the MySQL error log
This often occurs when changing the hostname of the slave (ie, master failover) and relay-log is not set in the my.cnf.
The answer here is to simply issue ‘show slave status\G’ and record the current master log file and position. Then reset the slave, and change master back to exactly where it was. Not that this requires the replication credentials.
1. display current replication information
SHOW SLAVE STATUS\G
Note the Master_Log_File and Read_Master_Log_Pos.
2. Reset the slave – note that this will completely reset the slave, removing all master info – do not do this if you do not have your master info noted.
RESET SLAVE ALL;
3. Setup replication again by issuing a change master statement.
CHANGE MASTER TO MASTER_HOST='master_ip', MASTER_USER='replicationuser', MASTER_PASSWORD='replicationpass', MASTER_LOG_FILE='(from above)', MASTER_LOG_POS= (from above);
Then start the slave and you should be good.
START SLAVE;
Leave a Reply