Import. csv data into MySQL

Source: Internet
Author: User
Tags first row file permissions

1. First look at the data I need to import:

When opened with Excel, displays:

Open the display with notepad++ as:

2. Use notepad++ to open change character set to UTF-8

3, create a table, the fields in the table to be consistent with the file

3. Execute the command (my file is placed under local e-disk)

LOAD DATA LOCAL INFILE ' e:/ihg_ipy20180405135615_bi.csv '
Into TABLE ' Ihg_hotel '
Fields TERMINATED by ', ' optionally-enclosed by ' "' escaped by '" '
LINES TERMINATED by ' \ r \ n '

IGNORE 1 rows;--need to ignore one line, because my first row is the table header

Note that if you add the local parameter, users who do not have file permissions will report

Error 1045 (28000): Access denied for USER ' mip ' @ '% ' (USING password:yes) This bug

Import. csv data into MySQL

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.