[root@sample ~]# mysql -u root -p ← 用root登录到MySQL服务器
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数据库
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; ← 确认test中的表被定义的值
+------+--------------------+
| num | name |
+------+-------------------+
| 1 | Shit,Windows | ← 确认已经将原test数据库表中的值修改为新的值“Shit,Windows”
+------+-------------------+
1 row in set (0.00 sec)
mysql> exit ← 退出MySQL服务器
Bye |
以上,我们就等于模拟了数据库被篡改的过程。接下来,是数据库被“篡改”后,用备份进行恢复的方法。
[root@CentOS ~]# /bin/cp -Rf /backup/mysql/test/ /var/lib/mysql/ ← 复制备份的数据库test到相应目录 |
然后,再次登录到MySQL服务器上,看数据库是否被恢复到了被“篡改”之前的状态。
[root@CentOS ~]# mysql -u root -p ← 用root登录到MySQL服务器
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数据库
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; ← 查看数据库中的内容
+------+----------------+
| num | name |
+------+----------------+
| 1| Hello,CentOS | ← 确认数据表中的内容与被修改前定义的“Hello,CentOS”一样!
+------+----------------+
1 row in set (0.01 sec)
mysql> exit ← 退出MySQL服务器
Bye |
|