
Mysql字符集和校对规则
show charset; show collation;开发规范:
建库、建表时都要加字符集 create database oldboy charset utf8; CREATE TABLE `test` ( `id` int(4) NOT NULL AUTO_INCREMENT, `name` char(20) NOT NULL, PRIMARY KEY (`id`) ) CHARSET=utf8;排序规则:
show collation; 大小写敏感不敏感 utf8_general_ci :utf8 默认校对规则,大小写不敏感 utf8_bin :大小写敏感生产环境更改数据库(含数据)字符集的方法
alter database oldboy CHARACTER SET utf8 ; alter table t1 CHARACTER SET utf8;