phpmyadmin误删表后如何恢复

用mysqlbinlog

php处理代码:

将mysql-bin.xxxxxx文件导出为可读文本:

<?php
//导出mysql-bin.000xxx文件为可读性txt文本
//0为执行成功,1为失败
//system("cd D:/wamp/bin/mysql/mysql5.5.8/data",$comReturn);
for ($i=200;$i<267;$i++){
$command = "D:/wamp/bin/mysql/mysql5.5.8/bin/mysqlbinlog D:/wamp/bin/mysql/mysql5.5.8/data/mysql-bin.000".$i." >> D:/baksql/baksqlaa.txt";
system($command,$comReturn);
var_dump($comReturn);
}
?>

分离出需要执行的语句:

<?php
//导出sql语句
$file = "D:/baksql/baksqlaa.txt";
$arr = file($file);
$str = '';
$insert = "INSERT INTO `che`.`che_tuangou`";
$update = "UPDATE `che`.`che_tuangou`"; foreach ($arr as $v){
if (stripos($v, $insert) !==false) {
$str .= $v.";\r\n";
}
}
file_put_contents("D:/insertsql.txt", $str);
?>
上一篇:SET Transaction Isolation Level Read语法的四种情况


下一篇:阿里云四大海外节点开服进入全球通时代