第二步,模拟数据丢失
| mysql> use game; Database changed mysql> show tables; +----------------+ | Tables_in_game | +----------------+ | country | | fight | | hero | +----------------+ 3 rows in set (0.00 sec) mysql> drop table hero; Query OK, 0 rows affected (0.00 sec) mysql> drop table country; Query OK, 0 rows affected (0.00 sec) |
第三步,查看数据是否正常
| [root@serv01 databackup]# mysql -uroot -p123456 < game_hero_country.sql ERROR 1046 (3D000) at line 22: No database selected [root@serv01 databackup]# mysql -uroot -p123456 --database game < game_hero_country.sql [root@serv01 databackup]# mysql -uroot -p123456 -e "select * from game.country" +-----+---------+----------+ | cno | cname | location | +-----+---------+----------+ | 10 | caowei | luoyang | | 20 | shuhan | chengdou | | 30 | sunwu | nanjing | | 40 | houhan | luoyang | | 50 | beisong | kaifeng | | 60 | 魏国 | 洛阳 | +-----+---------+----------+ |
通过这两天关于MySQL热备和冷备的学习,大家是不是对MySQL备份与恢复的了解更加深入了,不管是冷备还是热备其目的都是一致的保证数据的完整性和一致性,切记,备份重于一切!!!
相信今天所学的知识在之后的学习工作中对大家有所帮助。










