Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I had used --report-host option in one of my slaves, so that I could see that under SHOW SLAVE HOSTS. Now that server is no longer in use. I have uninstalled that server as well. Unfortunately I still see the details of that server under SHOW SLAVE HOSTS(When this is executed on the uninstalled server's master) which is incorrect.

What changes should I make such that SHOW SLAVE HOSTS gives me the correct output?

share|improve this question

You will have to check the following items

  • If the decommissioned Slave server still has /etc/my.cnf, do one of the following
    • rm -f /etc/my.cnf
    • mv /etc/my.cnf /etc/my.cnf.old
  • If the Master Server still has any --report-host in its /etc/my.cnf
    • remove report-host from /etc/my.cnf
    • service mysql restart
  • You may need service mysql restart on the Master anyway
  • Make sure you delete in the datadir of the old Slave

Give it a Try !!!

share|improve this answer
I am afraid it did not work. – omggs Sep 5 '12 at 7:30
Updated my answer... – RolandoMySQLDBA Sep 5 '12 at 14:52

I was fighting with the exact same problem in a more intricate replication setup M1 <-> M2 -> S1 -> S2 where M1 and M2 is an active-passive (passive server = read-only) master-master replication setup and S1 + S2 are regular slaves chained from M2 via S1 to S2.

I looked at Rolando's answer which seemed irrelevant to me and I tried Shlomi's answer in several different test setups but couldn't get it working.

In the end I had to study MySQL's source code to find out where data in SHOW SLAVE HOSTS comes from and how to "flush" it. Turns out that when a slave registers to a master it runs SHOW SLAVE HOSTS on the master and add that output to its own slave_list hash structure which is used as output for SHOW SLAVE HOSTS.

In my case with master-master replication it meant it did not matter what I did locally, I had to reset data at master for it to be refreshed at slave.

To answer this actual question a restart of the MySQL server should clear the output if it's a master -> slave setup and the master itself is not a slave of any other server.

Additionally, if anyone face the same situation as me above with master-master replication here are the steps to solve it:

  1. Issue STOP SLAVE on both masters (stops replication temporarily).
  2. Add skip-slave-start to my.cnf (server config file) on both servers. This prevents the slave thread from automatically starting upon restart.
  3. Restart mysqld on both servers (e.g. service mysql restart)
  4. Issuing SHOW SLAVE HOSTS on both servers should now give empty outputs.
  5. Run START SLAVE on both. Each will fetch the other master's empty list to begin with.
  6. Remove skip-slave-start again from both my.cnf files
  7. Now SHOW SLAVE HOSTS on both servers should only list active servers.
share|improve this answer

I find that executing a FLUSH command helps in refreshing the SHOW SLAVE HOSTS output. It isn't deterministic; I sometimes need to execute two or three FLUSH commands, but it certainly refreshes.

I found that either FLUSH LOGS or FLUSH STATUS do the job.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.