一个简单的恢复测试
做全库备份:
C:\Program Files\MySQL\MySQL Server 5.0\bin>mysqldump -uroot -p
--single-transaction --flush-logs --master-data=2 mytest > backup_mytest.sql Enter password: ******
备份后创建新的测试表并INSERT测试数据:
C:\Program Files\MySQL\MySQL Server 5.0\bin>mysql -uTEST -p mytest Enter password: **** Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 10 to server version: 5.0.27-community-log Type 'help;' or '\h' for help. Type '\c' to clear the buffer. mysql> SHOW TABLES; +------------------+ | Tables_in_mytest | +------------------+ | aaa | | customer | | mytable | | sys_tests | | test | | test1 | | test_isam | +------------------+ 7 rows in set (0.00 sec) mysql> CREATE TABLE NEW_TABLE(ID VARCHAR(20),MC VARCHAR(60)); Query OK, 0 rows affected (0.28 sec) mysql> INSERT INTO NEW_TABLE VALUES('1','111'); Query OK, 1 row affected (0.23 sec) mysql> SELECT * FROM NEW_TABLE; +------+------+ | ID | MC | +------+------+ | 1 | 111 | +------+------+ 1 row in set (0.00 sec) mysql> FLUSH LOGS; Query OK, 0 rows affected (0.53 sec)
删除所有TABLE后:
mysql> SHOW TABLES; Empty set (0.00 sec)
我们从全库备份文件执行恢复操作:
C:\Program Files\MySQL\MySQL Server 5.0\bin>mysql -uroot -p mytest < backup_mytest.sql Enter password: ****** C:\Program Files\MySQL\MySQL Server 5.0\bin>mysql -uTEST -p mytest Enter password: **** Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 19 to server version: 5.0.27-community-log Type 'help;' or '\h' for help. Type '\c' to clear the buffer. mysql> SHOW TABLES; +------------------+ | Tables_in_mytest | +------------------+ | aaa | | customer | | mytable | | sys_tests | | test | | test1 | | test_isam | +------------------+ 7 rows in set (0.01 sec)
这时我们发现新创建的测试表丢失,我们将应用增量备份来恢复最新数据。
C:\Program Files\MySQL\MySQL Server 5.0\bin>mysqlbinlog -uroot -p
E:\MySqlData\mochasof-8ed6b1-bin.000003 | mysql -uTEST -p mytest Enter password: Enter password: ****** **** C:\Program Files\MySQL\MySQL Server 5.0\bin>mysql -uTEST -p mytest Enter password: **** Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 24 to server version: 5.0.27-community-log Type 'help;' or '\h' for help. Type '\c' to clear the buffer. mysql> SHOW TABLES; +------------------+ | Tables_in_mytest | +------------------+ | aaa | | customer | | mytable | | new_table | | sys_tests | | test | | test1 | | test_isam | +------------------+ 8 rows in set (0.02 sec) mysql> SELECT * FROM NEW_TABLE; +------+------+ | ID | MC | +------+------+ | 1 | 111 | +------+------+ 1 row in set (0.00 sec)
至此新创建的表NEW_TABLE恢复完成。MYSQL还支持基于时间点的恢复及设置自动恢复等,我们在这里不做太多讲述。
保留:: http://www.qqread.com/mysql/r396485.html相关图文阅读
频道图文推荐
健 康 咨 询
时 尚 咨 询
相关专题
- 专访MySQL CEO:MySQL与企业级应用 (0次浏览)
- 深入了解MySQL系统日常管理 (0次浏览)
- 如何保护MySQL重要数据 (0次浏览)
- 浅析MySQL数据库常用管理 (0次浏览)
- 缓存PHP页面代码 可减轻CPU和MYSQL负担 (0次浏览)
- 浅析Tomcat5配置Mysql JDBC数据库连接池 (0次浏览)
- MySQL数据库敏感数据安全保护六大措施 (0次浏览)
- apache+php+mysql+serv_u迷你傻瓜安装程序 (0次浏览)
- Oracle,SQL Server,MySQL的自增变量设置 (0次浏览)
- Win2003下APACHE+PHP5+MYSQL4+PHPMYADMIN的简 (0次浏览)



