The binary log contains “events” that describe database changes such as table creation operations or changes to table data. […] The binary log has two important purposes:
- For replication, the binary log on a master replication server provides a record of the data changes to be sent to slave servers. The master server sends the events contained in its binary log to its slaves, which execute those events to make the same data changes that were made on the master. See Section 18.2, “Replication Implementation”.
- Certain data recovery operations require use of the binary log. After a backup has been restored, the events in the binary log that were recorded after the backup was made are re-executed. These events bring databases up to date from the point of the backup. See Section 8.5, “Point-in-Time (Incremental) Recovery Using the Binary Log”.
The binary log is not used for statements such as SELECT or SHOW that do not modify data. […]
[…]
The binary log is generally resilient to unexpected halts because only complete transactions are logged or read back. […]
Passwords in statements written to the binary log are rewritten by the server not to occur literally in plain text. […]