和oracle字符集一样,有些晕,太细了
小结:
1,字符集分为:服务器,数据库,表,连接,列等
对应参数为:
mysql> show variables like 'chara%';
+--------------------------+----------------------------+
| Variable_name | Value |
+--------------------------+----------------------------+
| character_set_client | latin1 |
| character_set_connection | latin1 |
| character_set_database | gb2312 |
| character_set_filesystem | binary |
| character_set_results | latin1 |
| character_set_server | gb2312 |
| character_set_system | utf8 |
| character_sets_dir | /usr/share/mysql/charsets/ |
+--------------------------+----------------------------+
8 rows in set (0.00 sec)
mysql> show variables like 'collation%';#类似于oracle show parameter呵呵
+----------------------+-------------------+
| Variable_name | Value |
+----------------------+-------------------+
| collation_connection | latin1_swedish_ci |
| collation_database | gb2312_chinese_ci |
| collation_server | gb2312_chinese_ci |
+----------------------+-------------------+
3 rows in set (0.00 sec)
mysql>
2,创建或修改字符集
create dababase zxy character set gb2312;
alter database zxy character set gb2312;
set character_set_server=latin;
启动mysqld指定default_character_set参数
配置/etc/my.cnf中的client及server节关于default_character_set参数