Skip to content

Instantly share code, notes, and snippets.

@tonkatsu7
Last active November 8, 2020 00:24
Show Gist options
  • Save tonkatsu7/d84d117dec015e6b5217d0c13b70d110 to your computer and use it in GitHub Desktop.
Save tonkatsu7/d84d117dec015e6b5217d0c13b70d110 to your computer and use it in GitHub Desktop.
How MySQL 5.7 Handles 'utf8mb4' and the Load Data Infile lines terminated with CRLF
set global local_infile=1;
quit
# sh
sudo mysql --local-infile=1 -u root
# https://dzone.com/articles/mysql-57-utf8mb4-and-the-load-data-infile
# https://www.percona.com/blog/2016/07/05/mysql-5-7-utf8mb4-and-the-load-data-infile/
# https://stackoverflow.com/questions/14127529/mysql-import-data-from-csv-using-load-data-infile
# https://dev.mysql.com/doc/refman/5.7/en/load-data.html
LOAD DATA LOCAL INFILE 'ml-100k/u.item.crlf.txt'
INTO TABLE movielens.movies
CHARACTER SET utf8mb4
FIELDS TERMINATED BY '|'
LINES TERMINATED BY '\r\n'
(movieID, title, @var3) set releaseDate = STR_TO_DATE(@var3, '%d-%M-%Y');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment