Unicode UTF-8 comma-separated values (CSV) text files, which are exported or generated by such applications as Microsoft Access or Excel, can be imported to MySQL via LOAD DATA INFILE command. CSV data files that are in a Vietnamese legacy encoding should first be converted to Unicode UTF-8, using UnicodeConverter tool, before proceeding with the import.
Make sure that MySQL default charset is utf8. You may need to create the schema (i.e., database structure and tables) before executing the LOAD DATA command. This can be accomplished manually or by MySQL Migration Toolkit to re-create the schema in MySQL database and then use TRUNCATE command to clear the table (delete all rows) before importing. For example:
mysql> TRUNCATE TABLE authors;
mysql> DELETE FROM authors;
The import will be executed as follows:
mysql> LOAD DATA LOCAL INFILE 'authors.txt' INTO TABLE authors FIELDS TERMINATED BY ',' ENCLOSED BY '"' LINES TERMINATED BY '\r\n';
for a CSV file 'authors.txt' with records having data fields as follows:
1,"Nguyễn","Trần","Lý Thường Kiệt","Sài Gòn","Việt Nam","848-999-9999","firstname.lastname@example.org"
2,"Lê","Lý","Phố Quang Trung","Hà Nội","Việt Nam","848-888-8888","email@example.com"
The line terminator '\r\n' is for Windows systems; for Unix/Linux, '\n' is used.
Migrating from Microsoft SQL Server and Access to MySQL
MySQL Reference Manual: LOAD DATA INFILE Syntax
About import/export specifications and Schema.ini files
Automate the import or export process