Skip to content

Instantly share code, notes, and snippets.

@zlargon
Last active May 12, 2019 16:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zlargon/f6442db1d82cdb2f3540c994d3fa5a98 to your computer and use it in GitHub Desktop.
Save zlargon/f6442db1d82cdb2f3540c994d3fa5a98 to your computer and use it in GitHub Desktop.
import large CSV data
SET GLOBAL local_infile = true;
SHOW GLOBAL VARIABLES LIKE 'local_infile';
LOAD DATA LOCAL INFILE '<file.csv>'
INTO TABLE '<table_name>'
COLUMNS TERMINATED BY ','
OPTIONALLY ENCLOSED BY '"'
ESCAPED BY '"'
LINES TERMINATED BY '\r\n'
IGNORE 1 LINES; -- ignore the field names
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment