Created
August 19, 2016 06:00
-
-
Save braicauc/65769ca1b2cfde2071d45b8ff60d69a1 to your computer and use it in GitHub Desktop.
Upload CSV file into MySQL table
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use your command line tool to log into mysql with: | |
mysql -u root -p -h localhost | |
then ... | |
LOAD DATA LOCAL INFILE '/path/to/file.csv' | |
INTO TABLE databasename.yourtable | |
FIELDS TERMINATED BY ',' ENCLOSED BY '"' LINES TERMINATED BY '\n' | |
IGNORE 1 LINES | |
( | |
@field1, @field2, @field3, @field4, @field4, @field5 | |
) | |
SET field1=@field1, field2=@field2, field3=@field3, field4=@field4, field4=@field4; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment