MySQL Import and export

Source: Internet
Author: User
Tags mysql import

Http://www.cnblogs.com/wyzs/p/6762452.html

MySQL data import and export this way can quickly realize the fast import and export of millions level data.

(Operation only on server, operation fails when file exists)

    • Export to file (SELECT INTO outfile)
1234567891011 SELECT fields INTO OUTFILE ‘file_name‘    [{FIELDS | COLUMNS}                        字段        [TERMINATED BY ‘string‘]               字段之间分隔符号        [[OPTIONALLY] ENCLOSED BY ‘char‘]       字段被包含在char中间        [ESCAPED BY ‘char‘]                  忽略字段里出现的char    ]    [LINES        [STARTING BY ‘string‘]                 忽略开头是string的行        [TERMINATED BY ‘string‘]            行分隔符    ]FROM test_table;
    • Import data from a file to a MySQL table
1234567891011121314151617 LOAD DATA [LOW_PRIORITY | CONCURRENT] [LOCAL] INFILE ‘file_name‘    [REPLACE | IGNORE]                     遇到重复的时候处理方法,替换|忽略    INTO TABLE tbl_name                    导入数据的目的表名    [PARTITION (partition_name,...)]            分区选择    [CHARACTER SET charset_name]             字符集    [{FIELDS | COLUMNS}                   字段        [TERMINATED BY ‘string‘]           字段之间分隔符号        [[OPTIONALLY] ENCLOSED BY ‘char‘]     字段被包含在char中间        [ESCAPED BY ‘char‘]              忽略字段里出现的char    ]    [LINES        [STARTING BY ‘string‘]             忽略开头是string的行        [TERMINATED BY ‘string‘]           行分隔符    ]    [IGNORE number {LINES | ROWS}]          忽略行/列    [(col_name_or_user_var,...)]              目的表的表字段名或者用户变量名    [SET col_name = expr,...]                设置表字段值

MySQL Import and export

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.