user3705356
user3705356

Reputation:

Import txt file into MySQL database

Hi how can I import that kind of text file into MySQL data base Thanks in advance from Quebec City :)

"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",,,

Upvotes: 1

Views: 4337

Answers (3)

Uttam Kadam
Uttam Kadam

Reputation: 458

1: Open this file in excel, at the time opening the file it will ask you for format. Add there ,.
2: save that file in .csv format.
3: Create your database schema and
4: import .csv file through phpMyAdmin

Upvotes: 2

Ankit Bansal
Ankit Bansal

Reputation: 2358

For importing the file, use any server like wamp,xampp. They have the facility called phpMyAdmin which is the GUI for mysql. You can easily import any SQL file from there. Apart from importing the file, it provides many other featues.

Upvotes: 6

sdespont
sdespont

Reputation: 14025

Use command like this :

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

More info following the @Nemoden link : http://dev.mysql.com/doc/refman/5.1/en/load-data.html

Upvotes: 0

Related Questions