mysqlbinlog — Utility for Processing Binary Log Files •mysqlbinlog Backup Options •Static and Live Backups •Output File Naming •Example: mysqldump + mysqlbinlog for Backup and Restore •mysqlbinlog Backup Restrictions mysqlbinlog Backup Capabilities mysqlbinlog  can read binary log files and write new files containing the same content—that is, in binary format rather than text format. This capability enables you to easily back up a binary log in its original format.  mysqlbinlog  can make a static backup, backing up a set of log files and stopping when the end of the last file is reached. It can also make a continuous (“live” ) backup, staying connected to the server when it reaches the end of the last log file and continuing to copy new events as they are generated. In continuous-backup operation,  mysqlbinlog  runs until the connection ends (for example, when the server exits) or  mysqlbinlog  is forcibly terminated. When the connection ends,  mysqlbinlog  does not wait and retry the connection, unlike a replica server. To continue a live backup after the server has been restarted, you must also restart  mysqlbinlog . mysqlbinlog  can back up both encrypted and unencrypted binary log files . However, copies of encrypted binary log files that are generated using mysqlbinlog  are stored in an unencrypted format. Binary log backup requires that you invoke  mysqlbinlog  with two options at minimum: Important mysqlbinlog Backup Options •The  --read-from-remote-server  (or  -R ) option tells  mysqlbinlog  to connect to a server and request its binary log. (This is similar to a replica server connecting to its replication source server.) •The  --raw  option tells  mysqlbinlog  to write raw (binary) output, not text output. • --stop-never : Stay connected to the server after reaching the end of the last log file and continue to read new events. • --connection-server-id= id : The server ID that  mysqlbinlog  reports when it connects to a server. When  --stop-never  is used, the default reported server ID is 1. If this causes a conflict with the ID of a replica server or another  mysqlbinlog  process, use  --connection-server-id  to specify an alternative server ID. See Section 4.6.9.4, “Specifying the mysqlbinlog Server ID” . • --result-file : A prefix for output file names, as described later. Along with  --read-from-remote-server , it is common to specify other options:  --host  indicates where the server is running, and you may also need to specify connection options such as  --user  and  -- password . Several other options are useful in conjunction with  --raw : To back up a server’s binary log files with  mysqlbinlog , you must specify file names that actually exist on the server. If you do not know the names, connect to the server and use the  SHOW BINARY LOGS statement to see the current names. Suppose that the statement produces this output: 622 Static and Live Backups