MySQL Purge Binary Logs: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
No edit summary |
||
Line 18: | Line 18: | ||
# [http://dev.mysql.com/doc/refman/5.5/en/purge-binary-logs.html MySQL Reference Guide - PURGE BINARY LOGS Syntax] | # [http://dev.mysql.com/doc/refman/5.5/en/purge-binary-logs.html MySQL Reference Guide - PURGE BINARY LOGS Syntax] | ||
[[Category:Software]] | |||
[[Category:MySQL]] | [[Category:MySQL]] |
Revision as of 17:05, 21 February 2013
- Change to the directory containing the binary log files.
- Login to the all slave servers.
- # mysql -p -uroot
- Check which log file it is reading.
- mysql> SHOW SLAVE STATUS;
- Determine the earliest log file among all the slaves. This is the target file. If all the slaves are up to date, this is the last log file on the list.
- Check which log file it is reading.
- # mysql -p -uroot
- On the master server, flush the logs.
- # mysqladmin flush-logs -p -uroot
- Login to the master server.
- # mysql -p -uroot
- Obtain a listing of the binary log files.
- mysql> SHOW BINARY LOGS;
- Obtain a listing of the binary log files.
- # mysql -p -uroot
- Make a backup of all the log files you are about to delete. (This step is optional, but always advisable.)
- Purge the binary logs.
- mysql> PURGE BINARY LOGS BEFORE 'yyyy-mm-dd hh:mm:ss'; (note: the seconds is optional)