Mysqlbinlog
The tool that reads statements from the binary log. Logs of executed statements contained in a binary log file can be used to help recover from a crash.
MySQL database log, there are the following kinds of logs:
1. Error log:-log-error
2. Query log:-log
3. Slow query log:-log-slow-queries
4. Update log:-log-update
5. Binary log:-log-bin
This is a discussion of the MySQL binary log export, import, MySQL binary log full backup, incremental backup.
By default, all logs are created in the MYSQLD data directory, or the option settings for the/ETC/MY.CNF [mysqld] Settings section are manually specified.
Under Linux:
# input in [mysqld]
[Mysqld]
Log_long_format
log-bin =/data/mysql/3306/binlog
binlog_cache_size = 4M
Binlog_format = MIXED
max_ Binlog_cache_size = 16M
max_binlog_size = 512M
expire_logs_days = 30
Above, open the MySQL binary log and specify the path to save the log.
Binlog Log Open method
Add one line to the My.cnf file (Windows is My.ini).
[Mysqld]
Log-bin=mysqlbin-log #添加这一行就ok了 the name behind the = number, define it yourself.
Then we can do a simple operation of the database after the MySQL data files in the directory to see Binlog files
[Root@jimmyli mysql]# LL
-RW-RW----1 mysql mysql 813255 Nov 18:14 mysqlbin-log.000001
See this similar document, the proof is done.
Second, view the binary log file with the Mysqlbinlog command
Whether logging is enabled
Mysql>show variables like ' log_% ';
How to know the current log