Centos7-mysql-binlog-bump- backup and restore
Mysql backup is generally full database backup + binlog log incremental backup.
Perform a full library every few days and an incremental backup a few hours a day.
Binlog log
This binary log file records all the additions, deletions and modifications in the database..
The effect is
1, master-slave synchronization
2, reply to the database
Binlog enables vim my.cnf
Log-bin=/usr/local/mysql/data/mysql-bin specifies the location of the log file and enables the binlog function
Mysqlbinlog-v log file, you can view the contents of the log file
The mysql-bin.index file stores the location and name of the binlog log file
Backup and restore of binlog
Backup
Mysqlbinlog-v file name > file name. sql backs up the entire binlog file
Mysqlbinlog-v-- stop-position=300 / * / mysql-bin.000003 > / 300.sql back up a thousand 300 events of a binlog file as a 300.sql file
Mysqlbinlog-v-- start-position=600 / * / mysql-bin.000003 > / 600.sql stores the binlog files from the beginning to the end in 600.sql
Skipping is usually used to skip the wrong operation.
Reduction
Mysql-uroot-p123456
< /文件名字.sql 要按照顺序来执行,顺序错了回复的也会有问题 ------------------------------------------------------------------------- mysqldump mysql自带的备份工具 主要是将要把备份表的数据导出,成为sql脚本文件,算是逻辑备份 一般数据量少的情况下会选择mysqldump备份,如果量大就推荐其他备份工具了. mysqldump -uroot -p123456 --all-databases >/ gao.sql back up all
-- databases library name > gao.sql backup a single library
Library name Table name > gao.sql back up a single table
Mysql-uroot-p123456
< gao.sql 还原 --------------------------------------------------------------------------- 一般在生产环境下,备份都是使用脚本完成的,方便快捷,而且数据库一般晚上会是低峰期,所以通常备份在晚上 一个完整备份的脚本,因为虚拟机没有安装其他软件,所以如果需要微信,或者邮箱提醒,可以后期再加
There is also an incremental backup of binlog