1.1mysql Bin-log Log
MySQL's bin-log log is a database statement that records data additions and deletions. As a result, bin-log can be used as a database recovery file, which is also the basis for MySQL's master-slave replication.
1.1.1 Turn on MySQL's bin-log log
Vi/etc/my.cnf
Log-bin=mysql-bin//Add this statement and restart MySQL
1.1.2 To see if Bin-log is turned on:
Mysql>show variables like '%bin% ';
1.2.3.mysql of Bin-log Log Management
Mysql>flush logs; There will be a new Bin-log log at this time.
Mysql>show Master status; View Bin-log logs currently in use
Mysql>reset master; Clear all logs
1.2.4 Backup and recovery of data with Bin-log
Back up the database: The test database is named tests and the table is T.
Mysqldump–uroot–p test–l–f > '/tmp/test.sql '
-l Lock table,-F is to refresh the Bin-log log so that it can be restored to the backup time with the log before the refresh
Mysql>insert into t values (1); Insert a new record
Mysq>flush logs;
Mysql>drop table T; Delete a table
Recovering a Database
Mysql Test </tmp/test.sql
If you want to restore a record of the time after the database backup, you need to restore the Bin-log log
Mysqlbinlog mysql-00002.bin |mysql–uroot–p Test! []
Bin-log's log content we can see that it contains position points. The recovery log can also specify position points. --stop-position= "193".
The above is mysqldump backup content, next time in the update!
MySQL Backup and recovery