How to make your MySQL fully cultural (2) see characterset is all gbk and it will be successful.
In the old database of the UTF8 character set, the script for creating a Chinese support table is as follows, and the character set description is added to the field:
Create table 'test'. 'cn '(
'Zh 'CHAR (10) CHARACTER SET
Gb2312 COLLATE gb2312_chinese_ci not null,
'Chinese' INT (11) NOT NULL
)
ENGINE = MYISAM;
Note: character set can write both GB2312 and gbk, and gbk is better than GB2312.
Add a default character set declaration GBK for the newly created database, so that you do not need to declare each field when creating the table. this method looks simple and smooth, with no special Traces. we recommend that you use this method more.
Mysql> create database dbCN DEFAULT
Character set gbk COLLATE gbk_chinese_ci;
Create table 'dbcn'. 'cn '(
'Zh 'CHAR (10) not null,
'Chinese' INT (11) NOT NULL
)
ENGINE = MYISAM;
Mysql> insert into cn values ("Really? ", 1 );
Note: If these scripts cannot be entered using the bin/mysql command line, you can use mysql query Browser or program execution.
Shell> bin/mysql-u root -- default-character-set = gbk-p
Mysql> use test
Mysql> select * from cn;
+ -------- + ------ +
| Zh | Chinese |
+ -------- + ------ +
| Really? | 1 |
+ -------- + ------ +
1 row in set (0.00 sec)
-----------------------------
Finally, modify the startup file/etc/rc. d/rc. mysqld, change path/app/mysql/bin/mysqld_safe, and change path/app/mysql/var/web. add -- user = root -- default-character-set = gbk after pid/app/mysql/bin/mysqld_safe.