mysql不停库恢复

环境搭建:
yum -y install mysql-co*server
vim /etc/my.cnf
############
server-id=1
log-bin=bin
binlog-format=ROW
###############
systemctl restart mysql
systemctl enable mysqld
firewall-cmd --add-port=3306/tcp
firewall-cmd --add-port=3306/tcp --permanent
mysql
>show master status\G
>GRANT REPLICATION SLAVE ON *.* TO 'repl'@'%' IDENTIFIED BY 'repl';
>flush privileges;

>create database wumei;
>use wumei;
>CREATE TABLE `wumei`.`xiaoshou` (`id` int NOT NULL AUTO_INCREMENT, `name` varchar(255) NOT NULL,`jiage` int(255) NOT NULL,`sl` int(255) NOT NULL, `SJ` timestamp(6) NOT NULL ON UPDATE CURRENT_TIMESTAMP(6), PRIMARY KEY (`id`)

vim 1.sh
#############
#!/bin/bash
while :
do
mysql -e "insert into wumei.xiaoshou (name,jiage,sl,SJ) values ('baish','3','2',now());"
sleep 1
done
#################
sh -x 1.sh

脚本运行后
mysql
>select * from wumei.xiaoshou;
>delete from wumei.xiaoshou;
>select * from wumei.xiaoshou;

题目:在不停机的情况下恢复删除的数据

posted @ 2019-11-15 18:02  Wolf_Coder  阅读(273)  评论(0编辑  收藏  举报