What is Binary Log File in MySQL?- The binary log file contains information about statements that could have modified the data and how long it took to modify the data. The statements are stored as events in the file.
- The logs are written in binary format and stored in /var/lib/mysql Directory. Binary log files are most commonly used for data recovery and replication.
The binary log has two important purposes:
1. 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.
2. 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.