Halloween DealsAmazon USHalloween week deals: useful picks before month-endAmazon US: current deals, useful picks and tech finds.Check DealsClean PCRecommendedOne scan can reveal what keeps slowing WindowsLook for cleanup and repair opportunities.Run ScanHalloween DealsAmazon USOctober picks are moving - compare before checkoutAmazon US: current deals, useful picks and tech finds.See Picks×
FREEDOM251

Freedom251 › Blog › binary logs

How to Apply MySQL Binary Logs Manually to a Replica Server (MySQL 8.4 Guide)

By Freedom251 Team · · 10 min read

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Manual binary-log application is a controlled replay: inspect the source log, select coordinates that match the replica’s snapshot, pipe the chosen events through mysqlbinlog into the mysql client, then verify replication state and data. The procedure is useful for point-in-time recovery and narrowly scoped repair, but an incorrect position, mismatched snapshot, or second applier running at the same time can permanently diverge the replica.

What manual binary-log replay actually does

MySQL stores committed changes as events in binary-log files. mysqlbinlog reads those events and writes an executable representation; the MySQL client then sends that representation to the target server. Oracle’s MySQL 8.4 documentation describes the operation as processing mysqlbinlog output with the mysql client to apply events from the binary log.

As an Amazon Associate I earn from qualifying purchases.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

For statement-based events, the output is SQL. Row-based events are represented internally as BINLOG statements. Adding --base64-output=DECODE-ROWS --verbose makes row changes readable while inspecting a log, but those display options are not a substitute for the original event representation during replay.

Manual replay is not a replacement for normal replication. It is an intervention in which you choose a file and position (or a bounded range), stop competing appliers, execute the events, and deliberately return the replica to a known replication configuration.

#1 Best Overall
Seagate 2TB Portable Hard Drive | USB 3.0 (STGX2000400) | Everyday HDD storage. Plug-and-play backup. Windows & macOS. Adobe CC trial included. 1-Year Warranty
  • Easily store and access 2TB to content on the go with the Seagate Portable Drive, a USB external hard drive
  • Designed to work with Windows or Mac computers, this external hard drive makes backup a snap just drag and drop
  • To get set up, connect the portable hard drive to a computer for automatic recognition no software required
  • This USB drive provides plug and play simplicity with the included 18 inch USB 3.0 cable
  • The available storage capacity may vary.

Prepare the replica and the source

Do preparation before opening a binary log. The following conditions determine whether replay can be safe:

  • Have a consistent starting snapshot. The replica must contain a dump or physical snapshot whose contents correspond to a known position in the source’s binary log. A log cannot make an arbitrary, stale snapshot consistent.
  • Record the matching coordinates. Save the source binary-log file and position (or the relevant GTID set) captured with the snapshot. Those coordinates are the only defensible starting point.
  • Confirm source logging. Binary logging must be enabled on the source, and every server in the topology must have a unique, nonzero server_id.
  • Stop competing replication. If the target is an already configured replica, stop or isolate its normal receiver and applier threads before applying events manually. Two appliers changing the same data can interleave transactions and create divergence.
  • Use an appropriately privileged account. The account executing generated BINLOG statements needs BINLOG_ADMIN (or the deprecated SUPER privilege). MySQL also documents REPLICATION_APPLIER together with the privileges required by each event as an alternative arrangement.
  • Preserve evidence. Work in a maintenance window or disposable clone when possible. Keep the original binary logs, the exact command lines, command output, replica status, and error logs so the operation can be audited or diagnosed.

Do not begin by guessing a position from the time shown in a log. First identify the snapshot’s recorded coordinates, then inspect the surrounding event boundaries.

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Choose the correct coordinates

File and position

A file-position topology identifies a source log such as binlog.000123 and a byte position within that file. The position attached to a consistent snapshot is the point at which replay should begin. In MySQL’s replication syntax, SOURCE_LOG_POS=4 represents the start of events in a binary-log file; it is a protocol-level starting point, not a universal instruction to start every recovery at 4. Use 4 only when the snapshot and recovery plan specifically require the beginning of that file.

For a bounded repair, define both a start and a stop position. A stop position is an exclusive boundary in the selected file, so inspect the neighboring event groups and transactions before applying it. Never cut through a transaction merely because the numeric position looks convenient.

GTID coordinates

When both source and replica use GTIDs, the safer normal-resumption method is automatic positioning. Configure SOURCE_AUTO_POSITION = 1 rather than supplying file and position. Do not combine auto-positioning with SOURCE_LOG_FILE or SOURCE_LOG_POS; they are different coordinate systems.

Why the snapshot matters

Binary logs contain changes, not the complete data set. Replaying from a point earlier than the snapshot’s matching coordinate can apply rows twice; starting later leaves changes missing. Filtering differences, a partially loaded dump, or a snapshot taken while writes were inconsistent can produce the same symptoms as a bad position, so validate the snapshot provenance before blaming the log.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Inspect the log before executing anything

Inspection should be a separate, read-only step. For one file and a proposed range, run:

Rank #2
Seagate Portable 5TB External Hard Drive HDD – USB 3.0 for PC, Mac, PS4, & Xbox - 1-Year Rescue Service (STGX5000400), Black
  • Easily store and access 5TB of content on the go with the Seagate portable drive, a USB external hard Drive
  • Designed to work with Windows or Mac computers, this external hard drive makes backup a snap just drag and drop
  • To get set up, connect the portable hard drive to a computer for automatic recognition software required
  • This USB drive provides plug and play simplicity with the included 18 inch USB 3.0 cable
  • The available storage capacity may vary.
mysqlbinlog --base64-output=DECODE-ROWS --verbose 
  --start-position=START_POS --stop-position=STOP_POS 
  binlog.000123 | less

Replace START_POS and STOP_POS with the coordinates recorded for your recovery. Review the output for transaction boundaries, database and table names, DDL, session settings, and any event that could be unsafe on the target. The verbose decoded view is for human review; it does not alter the event stream that will be replayed.

Check whether the range crosses files or includes a transaction that starts before the selected start position. If it does, move the start to a deliberate event-group or transaction boundary. A range that begins in the middle of a transaction can fail, omit prerequisite changes, or leave the target only partly updated.

Apply a local binary-log range

One file

After review, apply exactly the approved range:

mysqlbinlog --start-position=START_POS --stop-position=STOP_POS 
  binlog.000123 | mysql --binary-mode=1 -u root -p

The shell pipeline reads the selected events and passes them directly to the target MySQL server. Enter the target account’s password when prompted. --binary-mode=1 keeps the client from rewriting binary data while consuming generated BINLOG statements.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Several consecutive files

List consecutive files in chronological order. Apply a start position only to the first file and a stop position only to the final file when the recovery range spans more than one file; otherwise process complete intermediate files. For example:

mysqlbinlog --start-position=START_POS 
  binlog.000123 binlog.000124 
  --stop-position=STOP_POS | mysql --binary-mode=1 -u root -p

Before running a multi-file command, verify that the files are from the same source and that their sequence is intact. Preserve the exact command and its terminal output. If the client exits with an error, stop and investigate rather than rerunning the entire range automatically; rerunning can duplicate transactions that already committed.

Read logs that are remote or encrypted at rest

If the required files are not local, stream them from the source with --read-from-remote-server (short form -R):

mysqlbinlog --read-from-remote-server 
  --host=source.example --port=3306 
  --user=binlog_reader --password 
  --ssl-mode=VERIFY_IDENTITY 
  binlog.000123 | mysql -u root -p

The account used by mysqlbinlog should be limited to the source access required for reading logs. Protect the connection with TLS. MySQL recommends VERIFY_CA or VERIFY_IDENTITY rather than REQUIRED when possible, because the stronger modes validate the server certificate instead of merely encrypting the connection.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #3
Seagate Portable 1TB External Hard Drive HDD – USB 3.0 for PC, Mac, PlayStation, & Xbox, 1-Year Rescue Service (STGX1000400) , Black
  • Easily store and access 1TB to content on the go with the Seagate Portable Drive, a USB external hard drive.Specific uses: Personal
  • Designed to work with Windows or Mac computers, this external hard drive makes backup a snap just drag and drop. Reformatting may be required for Mac
  • To get set up, connect the portable hard drive to a computer for automatic recognition no software required
  • This USB drive provides plug and play simplicity with the included 18 inch USB 3.0 cable
  • The available storage capacity may vary.

Remote streaming does not change coordinate discipline: inspect the exact range first, make sure the source is reachable and serving the expected file, and keep the target applier stopped. If logs are encrypted at rest, decrypt them only in a controlled location or use the remote-read path; do not create untracked copies of sensitive logs.

Return a file-position replica to normal operation

After manual replay has completed and validation shows that the target is ready, configure the source coordinates for the next event to fetch. Stop the receiver and applier while changing the configuration, then issue:

CHANGE REPLICATION SOURCE TO
  SOURCE_HOST='source_host',
  SOURCE_USER='replication_user',
  SOURCE_PASSWORD='password',
  SOURCE_LOG_FILE='binlog.000123',
  SOURCE_LOG_POS=START_POS;
START REPLICA;

Use the next valid coordinate, not automatically the command’s original start position. If the manual range ended immediately before an event, the restart position must point to that event. If you intentionally applied through a transaction, set the coordinate after that transaction. A wrong coordinate can replay an event twice or skip part of a transaction.

For a GTID topology, configure SOURCE_AUTO_POSITION = 1 and omit file-position options. The replica then negotiates missing GTIDs with the source. Do not add SOURCE_LOG_FILE or SOURCE_LOG_POS to an auto-position configuration.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Handling a failed transaction or an intentional skip

Skipping is a last-resort data decision, not a generic way to clear an error. First stop both the receiver and applier threads. Capture SHOW REPLICA STATUS, the error number and text, the relevant source and relay logs, and the executed GTID set where applicable.

Use mysqlbinlog to locate the failed event group and the next valid transaction boundary. Decide whether the transaction was already applied, whether it is safe to omit, and whether an equivalent corrective change must be made manually. Then set restart coordinates deliberately and start the replica. Never advance to a visually convenient byte offset inside a transaction.

Skipping can hide a real schema, privilege, filtering, or data-integrity problem. Preserve the pre-skip evidence and record the reason, operator, coordinates, and validation results. If the target’s state is uncertain, restoring a known-good snapshot is safer than repeatedly advancing positions.

Rank #4
Seagate Portable 4TB External Hard Drive HDD – USB 3.0, 1-Year Rescue | Everyday HDD storage. Plug-and-play backup. Windows & macOS. Adobe CC trial included. 1-Year Warranty
  • Easily store and access 4TB of content on the go with the Seagate Portable Drive, a USB external hard drive.Specific uses: Personal
  • Designed to work with Windows or Mac computers, this external hard drive makes backup a snap just drag and drop
  • To get set up, connect the portable hard drive to a computer for automatic recognition no software required
  • This USB drive provides plug and play simplicity with the included 18 inch USB 3.0 cable
  • The available storage capacity may vary.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Validate both replication and data

Replay is not complete when the pipe exits successfully. Run SHOW REPLICA STATUS and review:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
  • Receiver and applier running states after restart.
  • Source file and position, relay coordinates, and read/execute gaps.
  • Error numbers and messages; an empty current error is not proof that the data matches.
  • Executed GTID sets when GTIDs are enabled.
  • Any expected delay while the replica catches up.

Then compare the source and replica at the application level. Use known row counts, targeted key checks, or checksums appropriate to the affected tables. A coordinate match can coexist with divergence if the snapshot was wrong, filters differed, or an applier ran concurrently. Conversely, a temporary coordinate lag can be normal while the replica processes the remaining queue.

Keep the source and replica binary logs, status output, error logs, inspection output, and replay command together. This evidence is essential before resetting replication state, rebuilding a replica, or explaining an incident.

Manual replay or restart replication?

Decision factor Manual binary-log replay Restarting configured replication
Range control Exact file and position range can be inspected and applied. Normal threads continue from their configured coordinates or GTID set.
Source reachability Local files can be used offline; remote or encrypted logs require --read-from-remote-server and protected transport. Source connectivity and replication credentials must work continuously.
Coordinate model You choose boundaries explicitly and must avoid splitting transactions. File-position or GTID machinery advances coordinates automatically.
Privileges The replay account needs BINLOG_ADMIN (or deprecated SUPER), or REPLICATION_APPLIER plus event privileges. Configured replication users and the replica’s applier privileges must be valid.
Transaction risk High if a range starts, stops, or resumes at the wrong boundary; a second applier must be stopped. Lower for a healthy topology because the applier follows recorded boundaries, but existing errors still require diagnosis.
Auditability Exact files, commands, output, and reviewed ranges can be preserved. Status history and server logs provide the primary record.
Rollback options There is no automatic undo for committed events; restore a snapshot or perform a separately designed correction. There is likewise no automatic undo for already committed replicated changes.
Best fit Point-in-time recovery, offline repair, or a narrowly bounded intervention after normal replication is isolated. A consistent replica whose source, credentials, filters, and coordinates are already healthy.

Common failure modes and recovery choices

Permission errors for BINLOG statements

If the target rejects generated BINLOG statements, verify the executing account’s BINLOG_ADMIN privilege (or the deprecated SUPER equivalent). If using REPLICATION_APPLIER, grant the privileges required by the specific events. Do not solve a privilege error by switching to an all-powerful account without documenting the change.

Duplicate-key or already-applied errors

These often indicate that the selected start position is earlier than the snapshot coordinate or that part of the range was already committed before a retry. Stop the pipeline, compare the target’s data and coordinates with the saved status, and identify the last confirmed transaction before choosing a new boundary. Blindly rerunning can compound the mismatch.

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Unknown table, column, or schema errors

A DDL event may be missing, filtered, or ordered differently on the target. Inspect preceding events and compare schema definitions. Do not skip the failing transaction until you know whether omitting it will leave later row events impossible or semantically incorrect.

Errors after a network interruption

A broken pipe does not prove that no events committed. Capture the target status and error log, determine the last committed transaction, and resume from the next deliberate boundary. Reconnect only after this check.

Replica will not start after manual application

Run SHOW REPLICA STATUS and check source credentials, the configured coordinate model, filters, and the first reported error. File-position settings require SOURCE_LOG_FILE and SOURCE_LOG_POS; GTID settings require auto-positioning. Remove contradictory options rather than alternating between both models.

A concise operational runbook

  1. Freeze writes or schedule a maintenance window, and stop the replica’s receiver and applier threads.
  2. Confirm the snapshot, source log files, server IDs, account privileges, and topology coordinate model.
  3. Record the snapshot-matching file and position or GTID set.
  4. Inspect the proposed range with decoded row output and verify complete transaction boundaries.
  5. Apply the reviewed local or remote range with the exact command recorded.
  6. On any error, stop, preserve evidence, and identify the last confirmed boundary before retrying.
  7. Validate status, coordinates, GTIDs, and application-level rows or checksums.
  8. Configure file-position coordinates or GTID auto-positioning for normal replication, then start the replica.
  9. Recheck status and data after the replica catches up; retain all logs and command output.

Version and safety scope

The commands and privilege names here target the MySQL 8.4 Reference Manual behavior available on October 15, 2026. MySQL syntax and privilege requirements can differ by release and by managed-service policy, so verify them against the exact server version before execution. Manual replay always reexecutes data modifications; it does not provide an undo log. Treat every position change, skipped transaction, and reset of replication state as a change-management event.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Quick Recap

Bestseller No. 1
Seagate 2TB Portable Hard Drive | USB 3.0 (STGX2000400) | Everyday HDD storage. Plug-and-play backup. Windows & macOS. Adobe CC trial included. 1-Year Warranty
Seagate 2TB Portable Hard Drive | USB 3.0 (STGX2000400) | Everyday HDD storage. Plug-and-play backup. Windows & macOS. Adobe CC trial included. 1-Year Warranty
This USB drive provides plug and play simplicity with the included 18 inch USB 3.0 cable; The available storage capacity may vary.
$129.99
Bestseller No. 2
Seagate Portable 5TB External Hard Drive HDD – USB 3.0 for PC, Mac, PS4, & Xbox - 1-Year Rescue Service (STGX5000400), Black
Seagate Portable 5TB External Hard Drive HDD – USB 3.0 for PC, Mac, PS4, & Xbox - 1-Year Rescue Service (STGX5000400), Black
This USB drive provides plug and play simplicity with the included 18 inch USB 3.0 cable; The available storage capacity may vary.
$219.99
Bestseller No. 3
Seagate Portable 1TB External Hard Drive HDD – USB 3.0 for PC, Mac, PlayStation, & Xbox, 1-Year Rescue Service (STGX1000400) , Black
Seagate Portable 1TB External Hard Drive HDD – USB 3.0 for PC, Mac, PlayStation, & Xbox, 1-Year Rescue Service (STGX1000400) , Black
This USB drive provides plug and play simplicity with the included 18 inch USB 3.0 cable; The available storage capacity may vary.
$119.80
Bestseller No. 4
Seagate Portable 4TB External Hard Drive HDD – USB 3.0, 1-Year Rescue | Everyday HDD storage. Plug-and-play backup. Windows & macOS. Adobe CC trial included. 1-Year Warranty
Seagate Portable 4TB External Hard Drive HDD – USB 3.0, 1-Year Rescue | Everyday HDD storage. Plug-and-play backup. Windows & macOS. Adobe CC trial included. 1-Year Warranty
This USB drive provides plug and play simplicity with the included 18 inch USB 3.0 cable; The available storage capacity may vary.
$189.99

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

binary logsDatabase administrationMySQLpoint-in-time recoveryReplication

Leave a Reply

Your email address will not be published. Required fields are marked *

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Recommended PC Tool
Recommended PC Tool
PC Slower Than It Used to Be?Free scan - under a minute
Outdated Drivers Are Slowing You DownFree scan - exact matches

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.