use information_schema;
desc tables; --一定记住tables表,information_schema中的metadata都可以查到-- 查看db的默认,DEFAULT_CHARACTER_SET_NAME/DEFAULT_COLLATION_NAMEselect * from schemata where schema_name = 'db_name';-- 查看table的,只有table_collation字段select * from tables where table_schema = 'db_name'and table_name = 'table_name';-- 查看column的,CHARACTER_SET_NAME/COLLATION_NAME都要select * from columns where table_schema = 'db_name'and table_name = 'table_name';
--查看mysql支持的character_set,Default collation是默认的"大小写敏感"select * from information_schema.character_sets;--就是执行了上面的sqlshow charset;
/*
查看各character set的collation,以gbk为例
gbk_chinese_ci是"大小写不敏感",ci是case sensitive的缩写
gbk_bin是"大小写敏感",以二进制(binary)存储
*/select * from information_schema.collations;showcollation;
show variables like'character_set%';--查看当前环境的character_set