MySQL mysqlimport import data from TXT file to MySQL database

Source: Internet
Author: User

Mysqlimport:

I say this we still have a better understanding of the world view methodology and more accurate grasp. Data import there are two parts to call

The first part: target object--who are we going to give the data to (Mysqlimport's target is naturally the table in the MySQL database.)

Part II: Data Source-The source of our data (the example below is only a text file)

That is to say, I can give the Mysqlimport order preliminary written mysqlimport-uusername-p databasename TableName filepath

DatabaseName indicates the name of the target database

TableName indicates the name of the target table

The source of the filename data

Read here is not feel mysqlimport know almost! It's not really yet. We still have an agreement not to say.

Mysqlimport the table name in the contract database is the same as the file name, which means we mysqlimport the order

  mysqlimport-uusername-p DatabaseName FilePath

See there is no more tablename because it will be taken from the filepath.

Example:

Data Source: D:\t.txt

      

Target: T table in test database

Statement:

Mysqlimport-uroot-p --fields-terminated-by=, test D:\t.txt

Operation Result:

        

--------------------------------------------------------------------------------------------------------------- ----------------------------------------------------------

The parameters to be mysqlimport in several comparisons

--fields-terminated-by=, #这个表示各个列之间用 ', ' separate.

--fields-enclosed-by= "#这个说明各个值是用 '" ' cause.

MySQL mysqlimport import data from TXT file to MySQL database

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.