diff --git a/internal/impl/mysql/snapshot.go b/internal/impl/mysql/snapshot.go index c78903497f..f062b7edb0 100644 --- a/internal/impl/mysql/snapshot.go +++ b/internal/impl/mysql/snapshot.go @@ -228,9 +228,15 @@ func (s *Snapshot) getCurrentBinlogPosition(ctx context.Context) (position, erro executedGtidSet any ) - row := s.snapshotConn.QueryRowContext(ctx, "SHOW MASTER STATUS") - if err := row.Scan(&file, &offset, &binlogDoDB, &binlogIgnoreDB, &executedGtidSet); err != nil { - return position{}, err + scanRow := func(row *sql.Row) error { + return row.Scan(&file, &offset, &binlogDoDB, &binlogIgnoreDB, &executedGtidSet) + } + + // "SHOW BINARY LOG STATUS" replaces "SHOW MASTER STATUS" IN MySQL 8.4+ + if err := scanRow(s.snapshotConn.QueryRowContext(ctx, "SHOW BINARY LOG STATUS")); err != nil { + if err = scanRow(s.snapshotConn.QueryRowContext(ctx, "SHOW MASTER STATUS")); err != nil { + return position{}, err + } } return position{