MySQL/Binary Logs

From Omnia
Jump to navigation Jump to search

Purge Master Logs

PURGE MASTER LOGS Syntax [1]

Deletes all the binary logs listed in the log index prior to the specified log or date. The logs also are removed from the list recorded in the log index file, so that the given log becomes the first.

Syntax:

PURGE {MASTER | BINARY} LOGS TO 'log_name'
PURGE {MASTER | BINARY} LOGS BEFORE 'date'

Examples:

PURGE MASTER LOGS TO 'mysql-bin.010';
PURGE MASTER LOGS BEFORE '2003-04-02 22:46:26';

Reset Master

RESET MASTER Syntax [2]

Deletes all binary logs listed in the index file, resets the binary log index file to be empty, and creates a new binary log file (staring at 1).

Syntax:

RESET MASTER

Show Logs

SHOW BINARY LOGS Syntax [3]

Lists the binary log files on the server.

Syntax:

SHOW BINARY LOGS
SHOW MASTER LOGS

Show Master Status

SHOW MASTER STATUS Syntax [4]

Provides status information about the binary log files of the master.

Syntax:

SHOW MASTER STATUS