How MYSQL imports CSV Format data file Solution _mysql

Source: Internet
Author: User

For their own backup, the experts please ignore.
The data is too large, use the database client software to import the very card directly, or execute SQL directly.
1, specify the file path.
2, the fields are separated by commas, data rows are separated by \ r \ n (my files here are separated by \ n).
3. The string is surrounded by a half-angle double quotation mark, and the double quotation marks in the string itself are expressed in two double quotes.

SQL code

Copy Code code as follows:

Load data infile ' D:\\top-1m.csv '
into table ' site '
Fields terminated by ', ' optionally enclosed by ' "' escaped by '" '
Lines terminated by ' \ n ';

Incidentally, also back up an export bar.
SQL code
Copy Code code as follows:

SELECT * from ' site '
into outfile ' d:\\top-1m.csv '
Fields terminated by ', ' optionally enclosed by ' "' escaped by '" '
Lines terminated by ' \ n ';

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.