Mysql import csv file _ MySQL

Source: Internet
Author: User
Tags mysql import
Mysql imports the csv file bitsCN.com

Mysql imports csv files

The mysql load data infile command can import DATA from the csv flat file to the database.

In linux:

Load data infile '/home/test/dump/ip_location.csv 'into TABLE ip_location character set utf8 fields terminated by', 'enabledby' "'; -- character set: mysql character set, be sure to add it to avoid the trouble of garbled characters -- into table: the TABLE to which the data is imported -- fields terminated by: what is used as the delimiter -- enclosed by: What is surrounded

Windows:

Load data infile "d:/insert_data.csv" replace into table demo character set gb2312 fields terminated by "," enclosed by "" lines terminated by "/r/n "; -- lines terminated by: this is different from linux. what is used as the end of a line.

BitsCN.com

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.