Import data from local text into MySQL database

Source: Internet
Author: User

The fields in the text file are separated by "," such as:

3144242807,wed Oct 22:44:28 CST 2013,30.536041,114.368019
2443892271,mon APR 09:21:39 CST 2014,30.545344,114.36576
2122771615,fri Sep 14:00:32 CST 2013,30.538091,114.370605
2495361967,wed APR 07:20:53 CST 2014,30.51601,114.36797
1580290180,mon Mar 08:48:25 CST 2014,30.521266,114.354564
2412804573,fri Dec 11:48:27 CST 2013,30.528417,114.349108
2550987072,sat Sep 09:18:37 CST 2013,30.538320906,114.35786387
2315714121,sat APR 19:18:40 CST 2014,30.506701,114.396202
2791776943,sat APR 19:28:19 CST 2014,30.52817201923,114.35958454844
2791776943,sat Oct 18:43:16 CST 2013,30.52809,114.35972

The SQL statement at import is:

LOAD DATA INFILE ' c:\\users\\hewenwu\\desktop\\usertimelime_whu11.txt ' into TABLE timeline_whu fields TERMINATED by ', ';

In the phpMyAdmin interface, click the SQL button, enter the above statement, click on the execution. Note the backslash in the file path takes two times.

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.