One, the function of binary log files
MySQL binary log records are all the changes in the MySQL database information, so very important to the database, the role of binary log I summed up the main include the following aspects:
1, can be used for the database based on Point-in-time restore.
2, can be used to analyze changes in the database, such as the bug caused the database data changes and so on.
3, the binary log can also be used to rebuild the database.
Two, binary log-related variables and parameters
Third, configure the binary log
1, open Bin-log log, modify in MY.CNF
Specify the path to the Bin-log log, open the log after the need for Myssqladmin flush log to take effect, after the reboot we found in the path just set up the log file, which is the binary log we need
Log-bin=/tmp/mysql-bin
2, the MySQL service that launches binary file
[Root@test4/]# mysqld_safe--defaults-file=/etc/my.cnf--log-bin=/tmp/1.0001--log-bin-index=/tmp/logbin.index-- max-binlog-size=10m--binlog-do-db=test
3, the contents of the binary log index file
mysql> system Cat/tmp/logbin.index
/tmp/1.000001
/tmp/1.000002
Iv. managing binary Logs
1, to see if the function of the binary log file is turned on
Mysql> Show variables like "%log_bin%";
+---------------------------------+-------+
| variable_name | Value |
+---------------------------------+-------+
| Log_bin | On |
| log_bin_trust_function_creators | Off |
| log_bin_trust_routine_creators | Off |
| Sql_log_bin | On |
+---------------------------------+-------+
2, view the binary file situation
Mysql> show master logs;
+----------+-----------+
| Log_name | File_size |
+----------+-----------+
| 1.000001 | 141 |
| 1.000002 | 106 |
+----------+-----------+
2 rows in Set (0.00 sec)
Mysql> show binary logs;
+----------+-----------+
| Log_name | File_size |
+----------+-----------+
| 1.000001 | 141 |
| 1.000002 | 106 |
+----------+-----------+
2 rows in Set (0.00 sec)