MacOS 10.6.8 Snow Leopard
MySQL 5.5.13
MySQL default installation (installed in the/usr/local/mysql directory)
See some of the character sets used for latin1 by show variables like ' character% ' command
In MacOS need to actively create a new configuration file, and make changes, most of the online modification of the sample after the execution of MySQL is no way to start, and then finally found a useful, record down memo
1. > sudo cp/usr/local/mysql/suportfiles/my-small.cnf/etc/my.cnf
Description
/ETC/MY.CNF If this file exists, it will be loaded as the MySQL default configuration file
However, the file permissions are special, no Super administrator can not operate, modify the file permissions for 777 after the MySQL service failed to start, so on the safe side, do not modify the file permissions, directly with the Super administrator operation is OK
2. > sudo vi/etc/my.cnf
Description
Use VI command to modify, but if not super admin also play not to turn
3. Under [client], add
Default-character-set = UTF8
Description
Online also use Default_character_set = UTF8 command, did not try, do not know this good to make
Note that there are spaces around the equals sign
4. Under [Mysqld], add
Default-storage-engine = INNODB
Character-set-server = UTF8
Collation-server = Utf8_general_ci
Description
Before the bad food is bad here, press before the online recommended in [mysqld] as long as add Default_character_set=utf8,mysql service will not come, depressed, according to the above configuration no problem
5. File save exit, restart MySQL service
6. Re-login MySQL use the command to view the character set, all changed to UTF8 is OK
Reference:
http://lj6684.iteye.com/blog/1204427
Revise the charset of MySQL to Uff-8