START SLAVE
(slave)
STOP SLAVE
(slave)
SET SQL_LOG_BIN=0|1
(master)
SET GLOBAL SQL_SLAVE_SKIP_COUNTER=n
(slave)
RESET MASTER
(master)
RESET SLAVE
(slave)
LOAD TABLE tblname FROM MASTER
(slave)
LOAD DATA FROM MASTER
(slave)
CHANGE MASTER TO master_def_list
(slave)
MASTER_POS_WAIT()
(slave)
SHOW MASTER STATUS
(master)
SHOW SLAVE HOSTS
(master)
SHOW SLAVE STATUS
(slave)
SHOW MASTER LOGS
(master)
SHOW BINLOG EVENTS
(master)
PURGE MASTER LOGS
(master)
PURGE MASTER LOGS
(master)
PURGE MASTER|BINARY LOGS TO 'logname' ; PURGE MASTER|BINARY LOGS BEFORE 'date'
The BEFORE
variant is available in MySQL 4.1; its date argument
can be in format 'YYYY-MM-DD HH:MI:SS'.
MASTER
and BINARY
are here synonyms.
Deletes all the
binary logs that are listed in the log
index as being strictly prior to the specified log or date, and
removes them from the
log index, so that the given log now becomes the first.
Example:
PURGE MASTER LOGS TO 'mysql-bin.010' ; PURGE MASTER LOGS BEFORE '2003-04-02 22:46:26' ;
This command will do nothing and fail with an error if you have an active slave that is currently reading one of the logs you are trying to delete. However, if you have a dormant slave, and happen to purge one of the logs it wants to read, the slave will be unable to replicate once it comes up. The command is safe to run while slaves are replicating -- you do not need to stop them.
You must first check all the slaves with SHOW SLAVE STATUS
to
see which log they are on, then do a listing of the logs on the
master with SHOW MASTER LOGS
, find the earliest log among all
the slaves (if all the slaves are up to date, this will be the
last log on the list), backup all the logs you are about to delete
(optional) and purge up to the target log.