真实的国产乱ⅩXXX66竹夫人,五月香六月婷婷激情综合,亚洲日本VA一区二区三区,亚洲精品一区二区三区麻豆

成都創(chuàng)新互聯(lián)網(wǎng)站制作重慶分公司

mysql誤刪除表內(nèi)數(shù)據(jù)怎么辦

這篇文章主要介紹了MySQL誤刪除表內(nèi)數(shù)據(jù)怎么辦,具有一定借鑒價值,感興趣的朋友可以參考下,希望大家閱讀完這篇文章之后大有收獲,下面讓小編帶著大家一起了解一下。

耿馬ssl適用于網(wǎng)站、小程序/APP、API接口等需要進行數(shù)據(jù)傳輸應用場景,ssl證書未來市場廣闊!成為成都創(chuàng)新互聯(lián)公司的ssl證書銷售渠道,可以享受市場價格4-6折優(yōu)惠!如果有意向歡迎電話聯(lián)系或者加微信:18982081108(備注:SSL證書合作)期待與您的合作!

#添加數(shù)據(jù)

insert into testdb1.student(id,name,class,score) value(a,'a',1,45),(2,'b',1,46),(3,'c',2,89),(4,'d',2,90),(5,'e',3,67),(6,'f',3,87),(7,'g',4,77),(8,'h',4,91);

mysql> select * from testdb1.student;

+------+------+-------+-------+

| id   | name | class | score |

+------+------+-------+-------+

|    1 | a    | 1     |    45 |

|    2 | b    | 1     |    46 |

|    3 | c    | 2     |    89 |

|    4 | d    | 2     |    90 |

|    5 | e    | 3     |    67 |

|    6 | f    | 3     |    87 |

|    7 | g    | 4     |    77 |

|    8 | h    | 4     |    91 |

+------+------+-------+-------+

8 rows in set (0.00 sec)

#刪除數(shù)據(jù)

mysql> delete from testdb1.student;

Query OK, 8 rows affected (0.00 sec)

mysql> commit;

Query OK, 0 rows affected (0.00 sec)

mysql> show master status\G

*************************** 1. row ***************************

             File: ray-bin.000004

         Position: 5444

     Binlog_Do_DB:

Binlog_Ignore_DB:

Executed_Gtid_Set:

1 row in set (0.00 sec)

[root@localhost ~]# mysqlbinlog /data/3306/logs/ray-bin.000004 -v -v -S /data/3306/soket/mysql.sock --base64-output=decode-rows | sed -n '/### DELETE FROM `testdb1`.`student`/,/COMMIT/P' | sed -n 's\### \\p' | sed "s/\/\*.*\*\///g" | sed 's/`//g' > /tmp/1.txt

[root@localhost ~]# sed 's/DELETE FROM/insert into/g' /tmp/1.txt | sed 's/WHERE/select/g' | sed 's/@4.*/\0;/g' | sed 's/@[1-3].*/\0,/g' | sed 's/[^@]\(.*\)=//g' > execSQL.sql

要點:

     sed 's/@4.*/\0;/g'  把@4后面匹配所有字符所有長度,替換,在匹配的后面添加。\0代表整行;

     sed 's/@[1-3].*/\0,/g'    把@后面從1到3匹配,在匹配后面所有字符所有長度,在匹配項后面添加逗號。\0代表整行。

     sed 's/[^@]\(.*\)=//g'  把已@開頭的到=以內(nèi)的內(nèi)容替換

mysql> source /root/execSQL.sql

Query OK, 1 row affected (0.00 sec)

Records: 1  Duplicates: 0  Warnings: 0

Query OK, 1 row affected (0.00 sec)

Records: 1  Duplicates: 0  Warnings: 0

Query OK, 1 row affected (0.00 sec)

Records: 1  Duplicates: 0  Warnings: 0

Query OK, 1 row affected (0.00 sec)

Records: 1  Duplicates: 0  Warnings: 0

Query OK, 1 row affected (0.00 sec)

Records: 1  Duplicates: 0  Warnings: 0

Query OK, 1 row affected (0.00 sec)

Records: 1  Duplicates: 0  Warnings: 0

Query OK, 1 row affected (0.00 sec)

Records: 1  Duplicates: 0  Warnings: 0

Query OK, 1 row affected (0.00 sec)

Records: 1  Duplicates: 0  Warnings: 0

mysql> commit;

Query OK, 0 rows affected (0.01 sec)

mysql> select * from testdb1.student;

+------+------+-------+-------+

| id   | name | class | score |

+------+------+-------+-------+

|    1 | a    | 1     |    45 |

|    2 | b    | 1     |    46 |

|    3 | c    | 2     |    89 |

|    4 | d    | 2     |    90 |

|    5 | e    | 3     |    67 |

|    6 | f    | 3     |    87 |

|    7 | g    | 4     |    77 |

|    8 | h    | 4     |    91 |

+------+------+-------+-------+

8 rows in set (0.00 sec)

感謝你能夠認真閱讀完這篇文章,希望小編分享的“mysql誤刪除表內(nèi)數(shù)據(jù)怎么辦”這篇文章對大家有幫助,同時也希望大家多多支持創(chuàng)新互聯(lián),關注創(chuàng)新互聯(lián)行業(yè)資訊頻道,更多相關知識等著你來學習!


網(wǎng)站欄目:mysql誤刪除表內(nèi)數(shù)據(jù)怎么辦
網(wǎng)站路徑:http://weahome.cn/article/jsdcsj.html

其他資訊

在線咨詢

微信咨詢

電話咨詢

028-86922220(工作日)

18980820575(7×24)

提交需求

返回頂部