Mysql outfile infile import and export data (append mysqldump)

Source: Internet
Author: User

Mysql outfile infile import and export data (append mysqldump) Export [plain] SELECT * into outfile '/tmp/jason.txt 'fields TERMINATED by', 'From test. jason; or [plain] SELECT * into outfile '/tmp/jason1.txt' fields terminated by ', 'optionally enclosed by' "'Lines terminated by '\ n' FROM test. jason1; output: "00:06:56", "100000198108800", "EXPORT_INFO", "BUY_ITEM_INNER", 100, "11", "2", "00:06:59 "," 1068029027 "," EXPORT_INFO "," BUY_ITEM_INNER ", 100000198108800," 11 "," 2 ", 70" 00:08:27 "," "," EXPORT_INFO ", "BUY_ITEM_INNER", "11", "2", 20 import [plain] load data infile '/tmp/jason.txt' into table aa. jason fields terminated by ','; or [plain] load data infile '/tmp/jason1.txt' into table aa. jason1 fields terminated by ', 'optionally enclosed by' "'Lines terminated by '\ n'; summary: F Ields terminated ', 'Field delimiter optionally enclosed by '"' will enclose the field and the number of invalid lines terminated by '\ n' line break mysqldump also has the same function [plain] mysqldump-uroot-p-T /tmp test fi -- fields-enclosed-by = \ "-- fields-terminated-by =" \ t "fi is the exported file name. Export export .txt test is the exported database name-T/tmp is the exported directory location -- fields-enclosed-by = \ "indicates that each data is enclosed in double quotation marks. -- fields-terminated-by =" \ t "indicates that each data is separated by a tab. Here, we will describe mysqldump. -- lock-all-tables, -x submit the request for locking before starting data export All tables to ensure data consistency. This is a global read lock and the -- single-transaction and -- lock-tables options are automatically disabled. After the backup is complete, the session is disconnected, it is automatically unlocked. -- Lock-tables,-l is similar to -- lock-all-tables, but it refers to locking the current data table to be exported, rather than locking the entire database table all at once, this option is only applicable to MyISAM tables. If it is an innodb table, you can use the -- single-transaction option. -- Single-transaction InnoDB table during backup, the option -- single-transaction is usually enabled to ensure backup consistency. In fact, its working principle is to set the isolation level of this session to repeatable read, to ensure that the data submitted by other sessions is not displayed during this session (dump. It is only applicable to transaction tables, such as Innodb or BDB. to export a large table, use the -- quick option. -- No-create-info,-t only exports data, without adding the create table statement -- no-data,-d does not export any table data, only export the table structure.

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.