How to import data using the load data command in MySQL

Source: Internet
Author: User

The usage is as follows:

Copy codeThe Code is as follows: mysql> load data local infile "D:/AB .txt" into table mytbl (name, age );

Using the preceding command, you can import the content of the D:/AB .txt file to mytbl. the nameand ageare the fields of mytbl, and correspond to the data in each row in the AB .txt file. If mysql is not specified during compilation and installation

-Enable-local-infile:

Copy codeThe Code is as follows: ERROR 1148 (42000): The used command is not allowed with this MySQL version

There are two solutions: one is to re-compile and install the above parameters, but directly run the command line, as shown below:

Copy codeThe Code is as follows: mysql-uroot-proot mydb_name -- local-infile = 1-e 'Load data local infile "D:/AB .txt" into table mytbl (name, age )'

I tested it. It took about three minutes to use the load data command to import 3 million data records!

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.