Importing data through the tool SQLyog

Source: Internet
Author: User
Tags terminates

You can graphically import data through the tool SQLyog.

1. Prepare Excel table

2. Import Excel tabular data into the MySQL database

(1) Open the prepared Excel table and choose save format as csv.

(2) If a Chinese character is present in the prepared Excel data table, the document character in the saved CSV format needs to be set to UTF-8. Otherwise the imported data is garbled.

(3) Open SQLyog, select the Import table to be imported. Right-click Import, select Import using locally loaded CSV data

(4) Set the fields that need to be canceled. And the escape character, field, and line termination.

The field terminates the general selection "," comma, because by default when Excel saves the CSV format, the fields are delimited by commas.

Line terminates the general selection \ n, which is the newline escape character: Line break (LF), moving the current position to the beginning of the next line.

Note: For example, the imported data above has the \ character, then the escape is \ \. It should also be set to \ \ In the imported data document (CSV). Otherwise the database is not recognized.

(5) Click the "Import" button when the above settings are complete and import.

By doing this, you will find it cumbersome and need to be provisioned again and again if there is a problem.

The following statement is equivalent to the above operation.

LOAD DATA LOCAL INFILE ' c:\\users\\administrator\\desktop\\test\\q.csv ' into TABLE ' m_test '. ' Sstest '
CHARACTER SET ' UTF8 ' fields escaped by ' \ \ ' TERMINATED by ', '
LINES TERMINATED by ' \ n ' (' name ', ' organization ', ' age ', ' date ')

Importing data through the tool SQLyog

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.