Skip to the content.

Import ‘.txt’ File To MySQL Database From Command Line

time mysql -u `username` -p`password` < import.sql

File Content of import.sql

TRUNCATE TABLE test.stat;

LOAD DATA INFILE '/tmp/1.txt'
INTO TABLE test.stat
FIELDS TERMINATED BY ','
ENCLOSED BY '"'
LINES TERMINATED BY '\n';