将txt文件导入MySQL数据库

时间:2012-12-05 06:08:33

标签: php mysql database text phpmyadmin

您如何将这种文本文件导入MySQL数据库 在魁北克市提前感谢:)

"8638671",1,1,"SAL",,,"12.8x16.9 P",,"RC","PFLO",,,
"8638671",2,2,"CUI",,,"10.11x12.6 P",,"RC","LINO",,,
"8638671",3,3,"SDB",,,"3.11x7.3 P",,"RC","LINO",,,
"8638671",4,4,"CCP",,,"8.6x10.2 P",,"RC","LINO",,,
"8638671",5,5,"SDL",,,"5.6x4.4 P",,"RC","LINO",,,
"8640420",1,1,"HAL",,,"5.5x3.3 P",,"RC","CERAM",,,
"8640420",2,2,"SAL",,,"11.1x21.8 P",,"RC","PFLO",,,
"8640420",3,3,"SAM",,,"9x11 P",,"RC","PFLO","porte-patio",,
"8640420",4,4,"CUI",,,"8x7.5 P",,"RC","CERAM",,,
"8640420",5,5,"SDB",,,"5x8 P",,"RC","CERAM",,,
"8640420",6,6,"SDL",,,"5x7.5 P",,"RC","LINO",,,
"8640420",7,7,"CCP",,,"11.5x13 P",,"RC","PFLO",,,
"8640420",8,8,"CAC",,,"9x10 P",,"RC","PFLO",,,
"8640420",9,9,"CAC",,,"7.5x9.10 P",,"RC","PFLO",,,
"8672024",1,1,"CUI",,,"10x8 P",,"RC","AU",,,
"8672024",2,2,"SAM",,,"15x10 P",,"RC","AU",,,

3 个答案:

答案 0 :(得分:6)

要导入文件,请使用像wamp,xampp这样的服务器。他们有一个名为phpMyAdmin的工具,它是mysql的GUI。您可以从那里轻松导入任何SQL文件。除了导入文件外,它还提供了许多其他功能。

答案 1 :(得分:1)

1:在excel中打开此文件,在打开文件时它会询问您的格式。添加,
2:以.csv格式保存该文件 3:创建数据库模式和
4:通过.csv

导入phpMyAdmin文件

答案 2 :(得分:0)

使用如下命令:

LOAD DATA LOCAL INFILE 'folder/myFile.txt' INTO TABLE myTable (field1, field2, field3, field4);

@Nemoden链接后的更多信息:http://dev.mysql.com/doc/refman/5.1/en/load-data.html