偷偷摘套内射激情视频,久久精品99国产国产精,中文字幕无线乱码人妻,中文在线中文a,性爽19p

MySQL數(shù)據(jù)庫被修改后的恢復(fù)方法

數(shù)據(jù)庫
MySQL數(shù)據(jù)庫可能存在被修改的危險(xiǎn),有些可能不是故意的修改,有的可能是故意進(jìn)行惡意破壞的,那么我們就要對(duì)被修改的數(shù)據(jù)庫進(jìn)行恢復(fù),下文中將為大家介紹數(shù)據(jù)庫恢復(fù)的方法。

MySQL數(shù)據(jù)庫的恢復(fù),之前已經(jīng)為大家介紹了MySQL數(shù)據(jù)庫中數(shù)據(jù)被刪除后的恢復(fù),本文為大家介紹另外一種恢復(fù)的情況,即MySQL數(shù)據(jù)庫被修改后的恢復(fù)。

當(dāng)數(shù)據(jù)庫被修改后的恢復(fù)方法:

數(shù)據(jù)庫被修改,可能存在著多方面的原因,被入侵、以及相應(yīng)程序存在Bug等等,這里不作詳細(xì)介紹。這里將只介紹在數(shù)據(jù)庫被修改后,如果恢復(fù)到被修改前狀態(tài)的方法。

具體和上面所述的“數(shù)據(jù)庫被刪除后的恢復(fù)方法”相類似。這里,測(cè)試用數(shù)據(jù)庫接著使用剛剛在前面用過的test。這里為了使剛剛接觸數(shù)據(jù)庫的朋友不至于理解混亂,我們?cè)俅蔚卿浀組ySQL服務(wù)器上確認(rèn)一下剛剛建立的測(cè)試用的數(shù)據(jù)庫test的相關(guān)信息。

[root@CentOS ~]# mysql -u root -p  ← 用root登錄到MySQL服務(wù)器
Enter password:  ← 輸入MySQL的root用戶密碼
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 14 to server version: 4.1.20

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql> show databases;  ← 查看當(dāng)前存在的數(shù)據(jù)庫
+-------------+
| Database |
+-------------+
| mysql |
| test  |
+------------+
2 rows in set (0.00 sec)

mysql> use test  ← 連接到test數(shù)據(jù)庫
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Database changed
mysql> show tables;  ← 查看test數(shù)據(jù)庫中存在的表
+-------------------+
| Tables_in_test |
+-------------------+
| test  |
+-------------------+
1 row in set (0.00 sec)

mysql> select * from test;  ← 查看數(shù)據(jù)庫中的內(nèi)容
+------+--------------------+
| num | name  |
+------+--------------------+
| 1 | Hello,CentOS|
+------+--------------------+
1 row in set (0.01 sec)

mysql> exit  ← 退出MySQL服務(wù)器
Bye

然后,我們?cè)俅芜\(yùn)行數(shù)據(jù)庫備份腳本,將當(dāng)前狀態(tài)的數(shù)據(jù)庫,再做一次備份。

[root@CentOS ~]# cd  ← 回到腳本所在的root用戶的根目錄
[root@CentOS ~]# ./mysql-backup.sh  ← 運(yùn)行腳本進(jìn)行數(shù)據(jù)庫備份
接下來,我們?cè)俅蔚卿浀組ySQL服務(wù)器中,對(duì)測(cè)試用的數(shù)據(jù)庫test進(jìn)行一些修改,以便于測(cè)試數(shù)據(jù)恢復(fù)能否成功。

[root@sample ~]# mysql -u root -p  ← 用root登錄到MySQL服務(wù)器
Enter password:  ← 輸入MySQL的root用戶密碼
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 15 to server version: 4.1.20

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql> use test  ← 連接到test數(shù)據(jù)庫
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Database changed
mysql> update test set name='Shit,Windows';  ← 然后將test中表的值重新定義為“Shit,Windows”(原來為“Hello,CentOS”)
Query OK, 1 row affected (0.07 sec)
Rows matched: 1 Changed: 1 Warnings: 0

mysql> select * from test;  ← 確認(rèn)test中的表被定義的值
+------+--------------------+
| num | name  |
+------+-------------------+
| 1 | Shit,Windows |  ← 確認(rèn)已經(jīng)將原test數(shù)據(jù)庫表中的值修改為新的值“Shit,Windows”
+------+-------------------+
1 row in set (0.00 sec)

mysql> exit  ← 退出MySQL服務(wù)器
Bye

以上,我們就等于模擬了數(shù)據(jù)庫被篡改的過程。接下來,是數(shù)據(jù)庫被“篡改”后,用備份進(jìn)行恢復(fù)的方法。

[root@CentOS ~]# /bin/cp -Rf /backup/mysql/test/ /var/lib/mysql/  ← 復(fù)制備份的數(shù)據(jù)庫test到相應(yīng)目錄


然后,再次登錄到MySQL服務(wù)器上,看數(shù)據(jù)庫是否被恢復(fù)到了被“篡改”之前的狀態(tài)。

[root@CentOS ~]# mysql -u root -p  ← 用root登錄到MySQL服務(wù)器
Enter password:  ← 輸入MySQL的root用戶密碼
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 16 to server version: 4.1.20

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql> use test  ← 連接到test數(shù)據(jù)庫
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Database changed
mysql> select * from test;  ← 查看數(shù)據(jù)庫中的內(nèi)容
+------+----------------+
| num | name  |
+------+----------------+
| 1| Hello,CentOS | ← 確認(rèn)數(shù)據(jù)表中的內(nèi)容與被修改前定義的“Hello,CentOS”一樣!
+------+----------------+
1 row in set (0.01 sec)

mysql> exit  ← 退出MySQL服務(wù)器
Bye


以上結(jié)果表示,數(shù)據(jù)庫被修改后,用備份后的數(shù)據(jù)庫成功的將數(shù)據(jù)恢復(fù)到了被“篡改”前的狀態(tài)。

測(cè)試后…

測(cè)試完成后,將測(cè)試用過的遺留信息刪除。

[root@CentOS ~]# mysql -u root -p  ← 用root登錄到MySQL服務(wù)器
Enter password:  ← 輸入MySQL的root用戶密碼
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 19 to server version: 4.1.20

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql> use test  ← 連接到test數(shù)據(jù)庫
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Database changed
mysql> drop table test;  ← 刪除test數(shù)據(jù)庫中的表
Query OK, 0 rows affected (0.01 sec)

mysql> drop database test;  ← 刪除測(cè)試用數(shù)據(jù)庫test
Query OK, 0 rows affected (0.00 sec)

mysql> show databases;  ← 查看當(dāng)前存在的數(shù)據(jù)庫
+-------------+
| Database |
+-------------+
| mysql |  ← 確認(rèn)測(cè)試用數(shù)據(jù)庫test不存在、已被刪除
+-------------+
1 row in set (0.00 sec)

mysql> exit  ← 退出MySQL服務(wù)器
Bye

如果大家以后在工作中遇到MySQL數(shù)據(jù)庫被修改,通過本文的學(xué)習(xí),到時(shí)候就能很輕松的應(yīng)對(duì),利用上文中介紹的進(jìn)行數(shù)據(jù)庫的恢復(fù)。

【編輯推薦】

  1. MySQL數(shù)據(jù)庫中數(shù)據(jù)被刪除后的恢復(fù)
  2. MySQL數(shù)據(jù)庫的自動(dòng)備份
  3. 兩大步驟教您開啟MySQL數(shù)據(jù)庫遠(yuǎn)程登陸帳號(hào)
責(zé)任編輯:迎迎 來源: 中國站長站綜合
相關(guān)推薦

2011-02-28 13:31:17

Oracle數(shù)據(jù)庫

2011-04-12 15:44:08

Oracle數(shù)據(jù)庫

2011-05-13 13:15:52

SYBASE ASA數(shù)

2011-08-02 16:03:47

Oracle數(shù)據(jù)庫冷備份冷備份異地恢復(fù)

2011-03-30 14:08:27

MySQL數(shù)據(jù)庫刪除恢復(fù)

2010-11-15 15:34:30

ORACLE數(shù)據(jù)庫恢復(fù)

2010-08-16 16:17:46

DB2數(shù)據(jù)庫備份參數(shù)

2019-08-20 14:02:07

MongoDB數(shù)據(jù)庫恢復(fù)數(shù)據(jù)

2018-04-28 15:28:44

數(shù)據(jù)庫MySQL誤刪除

2010-06-09 15:40:59

MySQL數(shù)據(jù)庫文件

2010-07-02 09:36:30

SQL Server

2018-05-17 17:05:05

Linux

2011-08-05 10:24:48

MySQL數(shù)據(jù)庫myisamchk

2010-05-04 09:36:02

Unix文件

2010-07-19 15:21:03

Win2000 Tel

2019-10-08 09:49:57

數(shù)據(jù)庫備份恢復(fù)

2010-08-04 14:38:34

路由器密碼

2010-09-02 14:04:20

2021-10-20 14:38:27

物聯(lián)網(wǎng)災(zāi)難恢復(fù)IOT

2010-10-19 14:19:07

SQL Server恢
點(diǎn)贊
收藏

51CTO技術(shù)棧公眾號(hào)