查看数据库的字符集
mysql> show variables like 'collation_%';
+----------------------+-----------------+
| Variable_name | Value |
+----------------------+-----------------+
| collation_connection | utf8_general_ci |
| collation_database | utf8_general_ci |
| collation_server | utf8_general_ci |
+----------------------+-----------------+
3 rows in set (0.00 sec)
mysql> show variables like 'character\_set\_%';
+--------------------------+--------+
| Variable_name | Value |
+--------------------------+--------+
| character_set_client | utf8 |
| character_set_connection | utf8 |
| character_set_database | utf8 |
| character_set_filesystem | binary |
| character_set_results | utf8 |
| character_set_server | utf8 |
| character_set_system | utf8 |
+--------------------------+--------+
7 rows in set (0.00 sec)
设置数据库字符编码
set names 'GBK'
alter database payment character set GBK;
create database mydb character set GBK;
set character_set_client=gbk;
set character_set_connection=gbk;
set character_set_database=gbk;
set character_set_results=gbk;
set character_set_server=gbk;
set character_set_system=gbk;
set collation_connection=gbk;
set collation_database=gbk;
set collation_server=gbk;
阅读(2818) | 评论(1) | 转发(0) |