Ask how to import TXT file into MySQL

Source: Internet
Author: User
How can I import txt file into MySQL
How to import TXT file into MySQL, this TXT file is from someone else's website, the format is fixed, is a space for the separator, the following is a TXT file part of the content:



Order-idorder-item-idpurchase-datepayments-datereporting-datepromise-datedays-past-promisebuyer-emailbuyer-namebuyer-phon E-numberskuproduct-namequantity-purchasedquantity-shippedquantity-to-shipship-service-levelrecipient-nameship-address-1sh Ip-address-2ship-address-3ship-cityship-stateship-postal-codeship-country
503-5296313-1551031675260543927982012-06-19t06:09:33+00:002012-06-19t06:09:33+00:002012-06-19t06:40:09+ 00:002012-06-21t14:59:59+00:003[email protected] 嫿 sick 媑 capacity Blinking 09021971453gv0123-gevey_pro-37saiphone4 懳 Cemetery sim despite 僢 僋 夝 screw inclination 僟 akha difference iOS4.21 摦 nakajimaduring husband 擣 嵪 try 101Standard 嫿 sick 媑 capacity blinking 恄 屗 巗 Joy Modern phone mo Enryakuji kamimachi 868-812 丂 hanzi 恄 price 儖 2F Event Navigation 655-0001JP
249-8506878-4596622090045092606222012-06-19t12:29:37+00:002012-06-19t12:29:37+00:002012-06-

------Solution--------------------
Do you use PHP?
The first line above is the database field below is the data so according to this format to read the number of groups and then assembled into SQL statement execution ...
------Solution--------------------
Create a table first. Then execute at the command line:
Load data local infile "C:/data.txt"
into table TT;

Remember not to mistake the path.

  • 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.