mysql修改库、表、字段 字符集,中文排序

查看字段编码:

show full columns from t2;
show variables like '%character%';
show variables like 'collation_%';
show variables like 'character_set_%';

修改库字符集:

alter database test character set gbk;

修改表字符集:

alter table t1 character set gbk;

修改字段字符集:

alter table t2 change name name varchar(50) character set gbk not null;

中文排序:

select id ,name from t2 where id > 10 order by convert(name using gbk ) desc;

 

posted @ 2016-09-02 15:41  潮白浪子  阅读(353)  评论(0编辑  收藏  举报