Place your import data file inside the database data directory e.g /var/lib/mysql/{database name}
Give the mysql user permission. chown mysql:mysql {data.csv}
mysql -uroot -p –local-infile=1 {database name}
Load the data:
LOAD DATA INFILE ‘{data.csv}’
INTO TABLE {table name}
FIELDS TERMINATED BY ‘,’ ENCLOSED BY ‘”‘
LINES TERMINATED BY ‘\r\n’
If your data has a field headings row, this can be omitted from the import with.
IGNORE 1 LINES;