==查看字符集==
//查看MySQL数据库服务器和数据库字符集 show variables like '%char%';
//查看表的字符集 show table status from mysql_db like '%tb_name%'
//查看表中所有列的字符集 show full columns from tb_name;
//查看mysql所支持的字符集 show charset;
==修改字符集==
//修改全局字符集
set character_set_connection=utf8;
set character_set_database=utf8;
set character_set_results=utf8;
set character_set_server=utf8;
set character_set_system=utf8;
set collation_connection=utf8;
set collation_database=utf8;
set collation_server=utf8;
//修改表的字符集 ALTER TABLE tb_name CONVERT TO CHARACTER SET gb2312;
//修改字段字符集 alter table tb_name modify column tb_column varchar(30) character set gb2312 not null;
修改系统默认字符集
http://blog.csdn.net/jayzym/article/details/52735314
使用vi编辑器打开my.cnf加入下面几段话
在[mysqld]上面加入下面两句话
[client]
default-character-set=utf8
在[mysqld]最下面加入下面几句话
default-storage-engine=INNODB
character-set-server=utf8
collation-server=utf8_general_ci
网友评论