本文摘自速学Python,微信公众号,
如有疑问,请参考公众号原文。
环境Linux,这个不用说了吧。
sudo rm-rf/* 删除数据库解决方案
/******************************/
首先安装ext3grep文件恢复工具
执行以下命令
sudo apt-get install ext3grep
或者从https://code.google.com/p/ext3grep/下载,解压到系统目录
ext3grep /dev/vgdata/LogVo100 --restore-all
ext3grep /dev/vgdata/LogVo100 --restore-title
var /lib/mysql/aqsh/tb-b-attench.MYD
ext3grep /dev/vgdata/LogVo100 --dump-names >/usr/allnames.txt
下面是一篇bash语言的脚本:
while read LINE
do
echo "begin to restore file " $LINE
ext3grep /dev/vgdata/LogVo100 --restore-file $LINE
if [ $? !=0]
then
echo “Restore failed ,exit”
exit 1
fi
done <.mysqltbname.txt/
extundelete /dev/vgdata/LogVo100 --restore-directory
var/lib/mysql/aqsh
ext3grep /dev/vgdata/LogVo100 --restore-file-fille
var /lib/mysql/mysql-bin.00000/
mysqlbinlog /usr/mysql-bin.000010 /mysql -uroot -p