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 :)
In the Format list, select CSV. Changing format-specific options. If the csv file is delimited by a character other than a comma or if there are other specifications to the csv files, we can change it in this portion. Click Go to start importing the csv file and the data will be successfully imported into MySQL.
CSV UTF-8 (comma delimited).This format is recommended for files that contain any non-ASCII characters since the classic CSV format destroys them. Besides CSV, there is one more format that may come in extremely handy for communicating with other programs.
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?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With