Importing UTF-8 into MySQL

Importing UTF-8 into MySQL

The MySQL command line tool does not correctly handle UTF-8 encoded source files by default. If you use the ’source’ command, Japanese turns into garbage. :(

To fix this, use the --default-character-set=utf8 option, e.g.

$ mysql -u
username --default-character-set=utf8 -p

This should allow you to use the ’source’ command to import your foreign language or otherwise special characters into MySQL without trouble.

Leave a Reply