In Linux:
MySQL version: ver 14.14 distrib 5.1.41
1 .)
VI/etc/My. CNF, add default-character-set = utf8 under [mysqld], and add default-character-set = utf8 under [client]
: WQ save and exit
2.) Run MySQL cmd, MySQL-> service MySQL restart
3) modify the MySQL database encoding. If the MySQL database encoding is incorrect, run the following command in MySQL: Alter database 'test' default Character Set utf8 collate utf8_bin.
The preceding command sets the encoding of MySQL's test database to utf8.
4). Modify the MySQL table encoding: alter table 'category 'default Character Set utf8collate utf8_bin. The preceding command is to change the category encoding of a table to utf8.
5 ). modify the field encoding: <br> alter table 'test' change 'dd' varchar (45) the character setutf8 collate utf8_bin not NULL command above is to change the DD field encoding in the MySQL database test table to utf8
You can use phpadmin to manage database settings.
6) Run
Show variables like 'character _ set % ';
Mysql> show variables like '% char % ';
+ ---------------------- + ---------------------
| Variable_name | value
+ ----------------------- + ---------------------
| Character_set_client | gb2312
| Character_set_connection | gb2312
| Character_set_database | gb2312
| Character_set_filesystem | binary
| Character_set_results | gb2312
| Character_set_server | gb2312
| Character_set_system | utf8
| Character_sets_dir |/usr/share/MySQL/charsets/
+ --------------------- + ----------------------
0