Call us Toll-Free:
Email us


How to manually process MySQL replication log files

Mike Peters, 07-15-2009
MySQL replication log files are simple text files, with a dump of all queries issued on the designated server.

At certain times, when MySQL slave servers fall behind, it may be useful to copy the log files over from the master to the slave machines and then manually process them.

To process a MySQL replication log file, copy the file from the master to the slave machine, then issue this command:

mysqlbinlog /usr/tmp/mysql-bin.000001 --start-position=1234 | sed -e 's/SET \/\*\!\*\//SET AUTOCOMMIT=0/g' | mysql -uUSERNAME -pPASSWORD

Replace 1234 with the last position the slave was able to read
Replace mysql-bin.000001 with the master file name
And replace USERNAME/PASSWORD with the slave database credentials
Enjoyed this post?

Subscribe Now to receive new posts via Email as soon as they come out.

Post your comments

Note: No link spamming! If your message contains link/s, it will NOT be published on the site before manually approved by one of our moderators.

About Us  |  Contact us  |  Privacy Policy  |  Terms & Conditions