[iyunv@centos7 binlog]# cd /var/lib/mysql/
[iyunv@centos7 mysql]# mysqlbinlog mysql-bin.000008
/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/;
/*!40019 SET @@session.max_insert_delayed_threads=0*/;
/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
DELIMITER /*!*/;
# at 4
#171203 16:35:29 server id 2 end_log_pos 245 Start: binlog v 4, server v 5.5.52-MariaDB created 171203 16:35:29 at startup
# Warning: this binlog is either in use or was not closed properly.
ROLLBACK/*!*/;
BINLOG '
UbcjWg8CAAAA8QAAAPUAAAABAAQANS41LjUyLU1hcmlhREIAbG9nAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAABRtyNaEzgNAAgAEgAEBAQEEgAA2QAEGggAAAAICAgCAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAikwNAA==
'/*!*/;
# at 245
#171203 16:36:38 server id 2 end_log_pos 314 Query thread_id=2 exec_time=0 error_code=0
SET TIMESTAMP=1512290198/*!*/;
SET @@session.pseudo_thread_id=2/*!*/;
SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1/*!*/;
SET @@session.sql_mode=0/*!*/;
SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/;
/*!\C utf8 *//*!*/;
SET @@session.character_set_client=33,@@session.collation_connection=33,@@session.collation_server=8/*!*/;
SET @@session.lc_time_names=0/*!*/;
SET @@session.collation_database=DEFAULT/*!*/;
BEGIN
/*!*/;
# at 314
#171203 16:36:38 server id 2 end_log_pos 424 Query thread_id=2 exec_time=0 error_code=0
use `datas`/*!*/;
SET TIMESTAMP=1512290198/*!*/;
insert into tb1 values (14,'hehe'),(15,'yaya')
/*!*/;
# at 424
#171203 16:36:38 server id 2 end_log_pos 451 Xid = 10
COMMIT/*!*/;
# at 451
#171203 16:54:34 server id 2 end_log_pos 520 Query thread_id=3 exec_time=0 error_code=0
SET TIMESTAMP=1512291274/*!*/;
BEGIN
/*!*/;
# at 520
#171203 16:54:34 server id 2 end_log_pos 618 Query thread_id=3 exec_time=0 error_code=0
SET TIMESTAMP=1512291274/*!*/;
insert into tb1 values (16,'yuyu')
/*!*/;
# at 618
#171203 16:54:34 server id 2 end_log_pos 645 Xid = 20
COMMIT/*!*/;
# at 645
#171203 16:54:56 server id 2 end_log_pos 728 Query thread_id=3 exec_time=0 error_code=0
SET TIMESTAMP=1512291296/*!*/;
drop database datas
/*!*/;
DELIMITER ;
# End of log file
ROLLBACK /* added by mysqlbinlog */;
/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/;
[iyunv@centos7 ~]# mysql < /backup/2017-12-03_15\:05\:00-all.sql
[iyunv@centos7 ~]# mysql < /backup/binlog/2017-12-03_16\:43\:29.sql
[iyunv@centos7 ~]# mysql < /backup/binlog/2017-12-03_16\:51\:11.sql
[iyunv@centos7 ~]# mysql < /backup/binlog/2017-12-03_17\:10\:02.sql
9.查看数据库及数据
1
2
3
4
5
6
7
8
9
10
11
12
MariaDB [datas]> select * from tb1;
+------+------+
| id | name |
+------+------+
| 11 | haha |
| 14 | hehe |
| 15 | yaya |
| 12 | hehe |
| 13 | yaya |
| 16 | yuyu |
+------+------+
6 rows in set (0.00 sec)
MariaDB [(none)]> grant reload,lock tables,replication client on *.* to 'backuser'@'localhost' identified by '123456';
Query OK, 0 rows affected (0.07 sec)