数据备份与恢复

数据备份  方法1

select * from  mysql_test.customers                 查表

into outfile   'C:/BACKUP/bcakupfile.txt'             备份目录,注意提前建BACKUP目录,备份的文件一定要跟数据库同一目录

fields  terminated by  ','                                           字段值之间用逗号

optionally  enclosed by ""                                         字段值有字符用双引号

lines terminated by  '?'  ;                                           每行结束用问号

数据备份  方法2

select  *  into  outfile  'C:/customers.txt'   from  customers   

数据恢复

前提是建立一张空表,属性顺序要一直,主要类型一直,否则容易报错。

load data infile  'C:/BACKUP/backupfile.txt'

into table mysql_test.customers_copy

fields   terminated by  ','

optionally  enclosed by  ""

lines   terminated by  '?';

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容