码迷,mamicode.com
首页 > 数据库 > 详细

数据库的表备份与恢复

时间:2014-12-16 06:28:44      阅读:175      评论:0      收藏:0      [点我收藏+]

标签:blog   ar   io   os   sp   on   文件   数据   div   

把数据导入到指定的文件:
table expression
into outfile ‘filename‘ <选项名称> |
into dumpfile ‘filename‘ |
into <user variable> <,....>
<选项名称>: fields [terminated by [literal] ] ....
	     lines terminated by <literal>	
as:
select *
from test
into outfile ‘test.txt‘
把test 数据导入到 test.txt文件,在linux 下,test.txt和test表的存放位置相同
默认值中:
fields terminated by ‘\t‘
lines terminated by ‘\n‘
enclosed by ‘‘
escapsed by ‘\\‘ as: select * from test into outfile ‘test.txt‘ fields terminated by ‘,‘ lines terminated by ‘?‘ 表示导出的数据中,字段之间用 ‘,‘分隔,行之间用 ‘?‘分隔 as: select * from test into outfile ‘test.txt‘ fields terminated by ‘,‘ optionally enclosed by ‘"‘ lines terminated by ‘?‘ 表示字符是用 ‘"‘包围的,如果全部用‘"‘包围,则不用加上 optionally 也可用dumpfile,但是所有行彼此挨着,值与行之间没有任何标志 as: select * from test into dumpfile ‘test.dump‘ 载入数据数据表中 load data [low_priority][concurrent][local] infile ‘filename‘ [replace] into table tablename [fields terminated by literal] [lines terminated by literal] as: load data infile ‘test.txt‘ replace into table test; as: load data infile ‘test.txt‘ replace into table test fields terminated by ‘,‘ line terminated by ‘?‘

 

数据库的表备份与恢复

标签:blog   ar   io   os   sp   on   文件   数据   div   

原文地址:http://www.cnblogs.com/lin3615/p/4166255.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!