问题
I'm trying to import about 10K rows of UTF-8 encoded data into a new MySQL table.
I can do so successfully with LOAD DATA INFILE
via MySQL Workbench but it the UTF-8 characters get mangled. I've tested the database otherwise via PHP and it accepts stores UTF-8 charaters fine. The problem seems to be with LOAD DATA INFILE
, and I've come across a few threads about this.
Does anyone know a workaround, or possibly another similarly easy method to import CSV data?
Thank you.
RESOLVED:
For others who see this and have the same problem, just add character set as a parameter when running LOAD DATA INFILE
. Simpler than I realised :)
回答1:
According to MySQL documentation for LOAD DATA, you can specify a CHARACTER SET
parameter in your statement to provide the input file character set.
Have you tried providing 'utf8'
as the input character set?
来源:https://stackoverflow.com/questions/2133198/importing-bulk-csv-data-in-utf-8-into-mysql