Monday, July 27, 2015

Import CSV File Into MySQL Table



If you want to import a csv file (where the values are separated by ';') into a mysql table you need to login in the mysql and enter next command:


LOAD DATA INFILE 'csv file path' 
INTO TABLE 'name table' 
FIELDS TERMINATED BY ';' 
ENCLOSED BY '"' 
LINES TERMINATED BY '\n';


It is possible that you will need to give permissions to the csv file:

$ chmod 777 'csv file path'



1 comment: