SQL Commands for Replication

It is possible to control replication, and to monitor what is going on, using SQL queries. Here are a few SQL commands for doing these things.

You can control and monitor the master using the following SQL commands:

  • SHOW MASTER STATUS displays information on the state of the master binary logs.

  • RESET MASTER clears (deletes) all binary logs from the master; this is useful if you want to start with a “clean sheet” and copy a fresh version of the database to the slave.

You can control and monitor the slave using the following commands:

  • SHOW SLAVE STATUS displays information on the current state of the slave, including whether it is running, the master it is connected to, and what position it is at in reading the master's ...

Get Sams Teach Yourself MySQL in 21 Days, Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.