MySQL Character Set
1. display character sets
Mysqladmin-uroot-proot variables | grep character
| Character_set_client | latin1 |
| Character_set_connection | latin1 |
| Character_set_database | latin1 |
| Character_set_results | latin1 |
| Character_set_server | latin1 |
| Character_set_system | utf8 |
| Character_sets_dir |/usr/local/share/mysql/charsets/|
Database uses latin1 (ISO-8859) by default)
Ii. configuring character sets
1. Configure character sets when creating a database
Create database testxxx default charset = utf8
3. Configure character set during table Creation
Create table 't_ agent '(
'Id' smallint (5) NOT NULL
) Default charset = utf8;
4. Modify Character Set
Windows Platform
In windows, the mysql configuration file is my. ini. Generally, it can be directly added to c: \ windows \ my. ini or c: \ winnt \ my. ini.
Default-character-set = gbk # Or gb2312, big5, utf8
Then restart mysql
Service mysql restart
Or
/Etc/init. d/mysql restart
Or use another method to restart the instance.
[Edit] Unix platform
The mysql configuration file in linux is my. cnf, which is usually/etc/my. cnf. If you cannot find it, run the find command to find it:
Find/-iname my. cnf
Add
Default-character-set = gbk # Or gb2312, big5, utf8
Then restart mysql
3. Configure the sorting Character Set
Myisamchk-r-q -- set-character-set = charset
4. Modify the character set when starting the database
./Mysqld_safe -- character-set-server = utf8 -- skip-character-set-client-handshake -- user = root &