辛星解读使用mysqldump来进行热备份(二)

2015-07-24 10:18:21 · 作者: · 浏览: 10
ldump --help C:\Users\Administrator>

这里我怕大家理解不是很清楚,就特意来解释下吧,第一个是说我们可以导出一个数据库,也可以导出一个数据库下的表,第二个是说我们可以导出n多个数据库,但是需要加上--databases来说明,第三个则直接导出所有数据库。

既然有备份,就会有恢复,我们使用mysql命令即可,比如我创建一个an数据库,它使用咱们备份的文件中的数据,咱们看下面操作,我就不单个演示了,这里咱们的数据库an就拿到了我们的备份数据,顺便说一下,这个数据库an必须提前建好,它不具有自己创建新数据库的能力:

C:\Users\Administrator>mysql -u root -proot an < D:\my.sql
mysql: [Warning] Using a password on the command line interface can be insecure.

C:\Users\Administrator>mysql -u root -proot
mysql: [Warning] Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 124
Server version: 5.7.3-m13 MySQL Community Server (GPL)

Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql>
use an Database changed mysql> show tables; +---------------------------+ | Tables_in_an | +---------------------------+ | columns_priv | | db | | event | | func | | general_log | | help_category | | help_keyword | | help_relation | | help_topic | | innodb_index_stats | | innodb_table_stats | | ndb_binlog_index | | plugin | | proc | | procs_priv | | proxies_priv | | servers | | slave_master_info | | slave_relay_log_info | | slave_worker_info | | slow_log | | tables_priv | | time_zone | | time_zone_leap_second | | time_zone_name | | time_zone_transition | | time_zone_transition_type | | user | +---------------------------+ 28 rows in set (0.00 sec) mysql>