导入本地文本中的数据到MySQL数据库中

时间:2014-05-08 15:16:50   收藏:0   阅读:407

文本文件中的字段是用“,”分隔的,如:

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

导入时的sql语句为:

LOAD DATA INFILE ‘C:\\Users\\hewenwu\\Desktop\\usertimelime_whu11.txt‘ INTO TABLE timeline_whu FIELDS TERMINATED BY ‘,‘;

 

在phpMyAdmin界面中点击sql按钮,输入以上语句,点击执行即可。注意文件路径中的反斜杠要用两次。

导入本地文本中的数据到MySQL数据库中,布布扣,bubuko.com

评论(0
© 2014 mamicode.com 版权所有 京ICP备13008772号-2  联系我们:gaon5@hotmail.com
迷上了代码!