标签:delete lis creat .com 技术 sql tar 备份数据库 val
MySQL增量备份与恢复增量备份:只备份那些在上次完全备份或者增量备份后被修改的文件才会被备份。
优点:没有重复数据,备份量不大,时间短。
vim /etc/my.cnf
log-bin=mysql-bing #添加二进制日志文件
systemctl restart mysql.service
mysql -u root -p #进入MySQL
create database client; #创建一个名为client的库
use client; #使用数据库
create table info (name varchar(10),score decimal(5.2)); #创建表
insert into info (name,score) values (‘zhangsan‘,88); #插入内容
insert into info (name,score) values (‘lisi‘,88);
quit #退出MySQL
mysqldump -u root -p client test > /opt/client.sql
mysqladmin -u root -p flush-logs
mysql -u root -p
use client
insert into info (name,score) values (‘test01‘,88);
quit #退出MySQL
mysqladmin -u root -p flush-logs
mysql -u root -p ;
use client;
drop tables test;
quit;
mysql -u root -p client < /opt/client.sql
mysqlbinlog --no-defaults /usr/local/mysql/data/mysql-bin.000002 | mysql -u root -p
mysql -u root -p
use client
insert into info (name,score) values (‘test01‘,88);
delete from test where name=‘lisi‘;
insert into info (name,score) values (‘test02‘,88);
quit
mysqladmin -u root -p flush-logs
mysql -u root -p ;
use client;
drop tables test;
quit
mysql -u root -p client < /opt/client.sql
mysqlbinlog --no-defaults --stop-datetime=‘18-07-06 10:39:23‘ /usr/local/mysql/data/mysql-bin.000003 | mysql -u root -p
mysqlbinlog --no-defaults--start-datetime=‘18-07-06 10:39:33‘ /usr/local/mysql/data/mysql-bin.000003 | mysql -u root -p
mysqlbinlog --no-defaults --stop-position=‘1151‘ /usr/local/mysql/data/mysql-bin.000003 | mysql -u root -p
mysqlbinlog --no-defaults--start-position=‘1226‘ /usr/local/mysql/data/mysql-bin.000003 | mysql -u root -p
标签:delete lis creat .com 技术 sql tar 备份数据库 val
原文地址:http://blog.51cto.com/13659182/2138579