Databases 7 min read

Why SHOW SLAVE HOSTS Returns the Master’s IP Instead of the Slave’s IP in MySQL Replication

This article explains why MySQL’s show slave hosts command on a master displays the master’s own IP instead of the replica’s, by examining the report_host parameter, deprecated syntax, and configuration copying practices, and provides steps to reproduce and resolve the issue.

Aikesheng Open Source Community
Aikesheng Open Source Community
Aikesheng Open Source Community
Why SHOW SLAVE HOSTS Returns the Master’s IP Instead of the Slave’s IP in MySQL Replication

1 Background

Someone installed a replica database and after establishing master‑slave replication, running show slave hosts; on the master shows the replica’s IP as the master’s own IP, which is puzzling.

For privacy, the example uses a local environment to reproduce the phenomenon.

2 Local Reproduction

Basic Information

Item

Master

Slave

IP

10.186.65.33

10.186.65.34

Port

6607

6607

Version

8.0.18

8.0.18

Problem Phenomenon

Running show slave hosts; on the master displays the master’s IP in the Host column.

The Host column shows the master’s IP.

On the replica, executing show slave status\G reveals the master host is 10.186.65.33, confirming normal replication.

mysql> show slave status\G
*************************** 1. row ***************************
                Slave_IO_State: Waiting for master to send event
                Master_Host: 10.186.65.33
                Master_User: universe_op
                Master_Port: 6607
                Connect_Retry: 60
              Master_Log_File: mysql-bin.000002
          Read_Master_Log_Pos: 74251749
                Relay_Log_File: mysql-relay.000008
                 Relay_Log_Pos: 495303
        Relay_Master_Log_File: mysql-bin.000002
                Slave_IO_Running: Yes
                Slave_SQL_Running: Yes

The replica is running correctly, but the Host reported by the master does not match the actual replica.

3 Documentation Review

Official documentation states that from MySQL 8.0.22 onward the show slave hosts statement is deprecated (still executable) and replaced by show replicas, though the underlying mechanism remains the same.

The data, especially the Host field, originates from the replica’s report_host parameter, which is part of the report‑xxxx set.

Running show variables like "%report%"; on the replica shows:

+-----------------+--------------+
| Variable_name   | Value        |
+-----------------+--------------+
| report_host     | 10.186.65.33 |
| report_password |              |
| report_port     | 6607         |
| report_user     |              |
+-----------------+--------------+
4 rows in set (0.01 sec)

This confirms that report_host contains the master’s IP.

Further inspection of my.cnf on the replica shows the report_port and related settings also point to the master, proving that these parameters are not dynamic; they are sent to the master when the replica registers, causing the master’s show slave hosts to display that IP.

4 Conclusion

In production the replica was created by copying the master’s configuration file without updating the report_host value, so the replica reports the master’s IP back to the master; consequently show slave hosts shows the master’s own IP, which can be confusing but does not affect replication operation.

When cloning a master, besides changing server_id, one must also adjust report_host, report_ip, and report_port to avoid this misleading output.

Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

mysqlReplicationDatabase Administrationreport_hostshow slave hosts
Aikesheng Open Source Community
Written by

Aikesheng Open Source Community

The Aikesheng Open Source Community provides stable, enterprise‑grade MySQL open‑source tools and services, releases a premium open‑source component each year (1024), and continuously operates and maintains them.

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.