It can be annoying when MySQL imports your UTF8 database (which contains exotic characters other than those in English) in the default character set of latin1_swedish_ci, jeopardizing the text content. It is also annoying when phpMyAdmin does the same and when you forgot to set the collation to utf8_general_ci for the new database which is very probably going to store utf8 characters.
Let’s fix this once and for all.
Just locate and open the MySQL configuration file my.ini and find the section [mysqld]. Add the following directive:
[mysqld] character-set-server=utf8 collation-server=utf8_unicode_ci
Save to my.ini and restart MySQL demon. Now MySQL will use utf8 as the default character set when importing databases or creating new databases. The default collation of phpMyAdmin has also changed to utf8_general_ci.
You should also read:
- mysql command line character set option for importing SQL files encoded in UTF8
- MySQL: How to backup ALL databases as root with mysqldump at once?
- How to Recover or Reset MySQL root Password after You Forgot and Lost It
- PHP: How to process a string one byte (character) at a time
- MySQL: Find non-ASCII characters in a table column