mysql不停库恢复
Posted Wolf_Coder
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了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 statusG
>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;
题目:在不停机的情况下恢复删除的数据
以上是关于mysql不停库恢复的主要内容,如果未能解决你的问题,请参考以下文章