事件背景
下載及安裝
https://codeload.github.com/danfengcao/binlog2sql/zip/master
https://codeload.github.com/PyMySQL/PyMySQL/tar.gz/v0.9.3
#yum install -y zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel gcc libffi-devel
#tar -xvf Python-3.8.2.tar.xz
#cd Python-3.8.2
./configure --prefix=/usr --with-ensurepip --with-system-ffi
make && make install
[email protected]:[/root/soft]python3 --version
Python 3.8.2
[email protected]:[/root/soft]pip3 --version
pip 19.2.3 from /usr/lib/python3.8/site-packages/pip (python 3.8)
#pip3 install PyMySQL-0.9.3.tar.gz
#pip3 install mysql-replication-0.21.tar.gz
root@localhost.localdomain:[/root/soft]pip3 list
Package Version
----------------- -------
mysql-replication 0.21
pip 19.2.3
PyMySQL 0.9.3
setuptools 41.2.0
#unzip binlog2sql-master.zip
#mv binlog2sql-master/binlog2sql ./
數(shù)據(jù)恢復(fù)
python binlog2sql/binlog2sql.py -utestuser -pxxx-dtestdb -t test --start-file=mysql-bin.000013 --start-datetime=2022-
03-01 14:30:00 --stop-datetime=2022-03-01 15:30:00 --only-dml –sql-type= DELETE >delete.txt
python binlog2sql/binlog2sql.py -B -utestuser -pxxx-dtestdb -t test --start-file=mysql-bin.000013 --start-
datetime=2022-03-01 14:30:00 --stop-datetime=2022-03-01 15:30:00 --only-dml –sql-type= DELETE >insert.txt
mysql>source insert.txt
文章版權(quán)歸作者所有,未經(jīng)允許請勿轉(zhuǎn)載,若此文章存在違規(guī)行為,您可以聯(lián)系管理員刪除。
轉(zhuǎn)載請注明本文地址:http://systransis.cn/yun/129441.html
摘要:引言數(shù)據(jù)庫一直是個大問題。那么如果做到防止數(shù)據(jù)庫誤刪或者是誤更新,可以參考下以下幾點,下面總結(jié)的都是業(yè)務(wù)層面,和一些配置層面。軟刪除的好處也很明顯,如果是業(yè)務(wù)發(fā)現(xiàn)誤刪,還能有回旋的余地。賬號在非必須情況下,盡量不要參與日常運維,維護的工作。 引言 ??數(shù)據(jù)庫一直是個大問題。如果沒有做數(shù)據(jù)備份,或者是開啟binlog,那真得就是沒了就是沒了,全表更新就是真的回不去了,就算開啟了備份,也很...
閱讀 1356·2023-01-11 13:20
閱讀 1707·2023-01-11 13:20
閱讀 1215·2023-01-11 13:20
閱讀 1906·2023-01-11 13:20
閱讀 4165·2023-01-11 13:20
閱讀 2757·2023-01-11 13:20
閱讀 1402·2023-01-11 13:20
閱讀 3671·2023-01-11 13:20