Mysql - CHARACTER and COLLATION

 

 

Doc 1 :   Case Sensitivity in String Searches    &     Case Sensitive collation in MySQL

 

Doc 2 :  Chinese document 与查询有关的事宜     &     字符集支持

 

Doc 3 : Using COLLATE in SQL Statements      &    SHOW Syntax

 

Doc 4 : ALTER TABLE COLLATION     &   Stackoverflow - MySql alter table Collation 

 

 Take a Look : How do I see what character set a database / table / column is in MySQL?

 

 


  

显示Mysql所有编码:

show character set; 

 

创建时指定数据库编码

create database <DataBase_Name> character set utf8 collate utf8_bin;

 

修改指定数据库编码

alter database <DataBase_Name> character set utf8 collate utf8_bin;

  

 


  

设置Mysql Databases编码:

 

show variables like 'character%';
SET character_set_client = utf8 ; (For all databases) 
SET character_set_connection = utf8 ; (For all databases) 
SET character_set_database = utf8 ; (For all databases) 
SET character_set_results = utf8 ; (For all databases) 
SET character_set_server = utf8 ; (For all databases) 
SET character_set_system = utf8 ; (For all databases) 
show variables like 'character%';

 

 


 

设置Mysql Table编码: 

show create table <table_name>;
ALTER TABLE <table_name> CONVERT TO CHARACTER SET utf8 COLLATE utf8_bin;

  

 

 

 

 

To see the specified table's collation:

SHOW FULL COLUMNS FROM <table_name>; -- or (show create table <table_name>;)

   

To see the database collations :

show variables like "character%";
show variables like "collation%";


  

 

 

 

posted @ 2013-10-23 12:58  makemelike  阅读(370)  评论(0编辑  收藏  举报