How to Enable Binary Logging for MySQL Server on Windows and Linux Machine - MySQL DBA Tutorial

MySQL Binary Logging in MySQL Server

The binary log contains a record of all changes ( CREATE, ALTER, INSERT, UPDATE and DELETE) to the databases, both data and structure.
It consists of a set of binary log files and an index file which contains name of binary log files. The data is saved in binary format.

Binary Log File in Windows:

If Binary logs are enabled without providing the location for binary log file, then by default location for the binary log will be "C:\ProgramData\MySQL\MySQL Server 8.0\Data" and file name will be "HostName-bin.00000x".

To make change for binary log file location and name , you can go to my.ini file on below path
"C:\ProgramData\MySQL\MySQL Server 8.0", Look for
# Binary Logging.

Binary Log File in Linux:

The default location for Binary log file for MySQL installed on Linux is /var/lib/MySQL. If you need to make changes to default location and binary file name, you can go to /etc/my.cnf file and update it.

Read Binary Log File: 

To read binary log file in Windows, you need to go to bin folder where mysqlbinlog application exists and then use below command on cmd.

mysqlbinlog -v binary-log-filename.00000X

On Linux, you should be able to run the same command. mysqlbinlog is the program that is used to read the binary log file into more readable format.

MySQL Logging Tutorial - How to Enable Binary Logging in MySQL in Windows and Linux


  1. Awesome article, it was exceptionally helpful! I simply began in this and I'm becoming more acquainted with it better! Cheers, keep doing awesome! Forex Trading Signals

  2. Likewise, don't get into Forex exchanging a clear record. You should go out and gain proficiency with as well as can be expected about Forex exchanging to give you a head start on the rest.Candlestick

  3. Pretty good post. I just stumbled upon your blog and wanted to say that I have really enjoyed reading your blog posts. Any way I'll be subscribing to your feed and I hope you post again soon. Big thanks for the useful info. pocket Option Forex