mysql的备份

1、SQL导出: mysqldump database table ;
     导入时使用:source hello.sql;
缺点:速度慢,占空间大;
2、使用界定符文件备份
     备份:mysql >  select * into outfile '/tmp/hello.txt' fields terminated by ',' optionally enclosed by '"' lines terminated by '\n' from test.test;
     还原:mysql > load data infile '/tmp/hello.txt' into table test.test fields terminated by ',' optionally enclosed by '"' lines terminated by '\n';

3、如果用mysql的软件Navicat for Mysql导出就按步骤转储即可,但是导入时一定要先创建一个数据库,然后导入,否则导入会错误。
4、并行导出与还原
    多个线程对多个表同时做导出或还原。可以自己编写多线程脚本或使用mk-parallel-dump工具。

posted @ 2018-11-28 09:12  ZYXLYFYWJ  阅读(162)  评论(0编辑  收藏  举报