MySQL字符集
檢視當前字符集
mysql> show global variables like '%server';
+----------------------+-------------------+
| Variable_name | Value |
+----------------------+-------------------+
| character_set_server | latin1 |
| collation_server | latin1_swedish_ci |
+----------------------+-------------------+
2 rows in set (0.00 sec)
設定字符集
mysql> set global character_set_server=gbk;
Query OK, 0 rows affected (0.00 sec)
mysql> show global variables like '%server';
+----------------------+----------------+
| Variable_name | Value |
+----------------------+----------------+
| character_set_server | gbk |
| collation_server | gbk_chinese_ci |
+----------------------+----------------+
2 rows in set (0.00 sec)
建庫指定字符集:
mysql> create database cms_app DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;
Query OK, 1 row affected (0.00 sec)
show collation like 'utf8%';
create table test(name varchar(30));
Query OK, 0 rows affected (0.01 sec)
mysql> insert into test values('我和我的祖國');
Query OK, 1 row affected (0.02 sec)
mysql> select * from test;
+--------------------+
| name |
+--------------------+
| 我和我的祖國 |
+--------------------+
1 row in set (0.00 sec)
mysql> show variables like 'character_set_client';
+----------------------+-------+
| Variable_name | Value |
+----------------------+-------+
| character_set_client | utf8 |
+----------------------+-------+
1 row in set (0.00 sec)
mysql> show global variables like 'character_set\_%';
+--------------------------+--------+
| Variable_name | Value |
+--------------------------+--------+
| character_set_client | latin1 |
| character_set_connection | latin1 |
| character_set_database | latin1 |
| character_set_filesystem | binary |
| character_set_results | latin1 |
| character_set_server | utf8 |
| character_set_system | utf8 |
+--------------------------+--------+
7 rows in set (0.01 sec)
會話級別的
mysql> show variables like 'character_set\_%';
+--------------------------+--------+
| Variable_name | Value |
+--------------------------+--------+
| character_set_client | utf8 |
| character_set_connection | utf8 |
| character_set_database | utf8 |
| character_set_filesystem | binary |
| character_set_results | utf8 |
| character_set_server | gbk |
| character_set_system | utf8 |
+--------------------------+--------+
7 rows in set (0.00 sec)
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/25846553/viewspace-2919807/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- 【Mysql 學習】mysql 字符集MySql
- 修改MySQL字符集MySql
- mysql 字符集修改MySql
- MySQL修改字符集MySql
- mysql的字符集MySql
- mysql字符集說明MySql
- 設定Mysql字符集MySql
- mysql字符集設定MySql
- mysql字符集小結MySql
- mysql字符集和字元排序MySql字元排序
- MySQL DB字符集修改方法MySql
- mysql 字符集亂碼探究MySql
- (6)mysql 中的字符集MySql
- Mysql字符集與字元序MySql字元
- mysql字符集與亂碼MySql
- 小談MySQL字符集(轉)MySql
- MySQL 不同版本預設字符集MySql
- 聊一聊MySQL的字符集MySql
- mysql伺服器的字符集MySql伺服器
- mysql 資料型別,字符集MySQL 資料型別
- Mysql 字符集引數翻譯MySql
- 【Mysql】iconv 轉換字符集MySql
- Ubuntu下修改mysql的字符集UbuntuMySql
- mysql亂碼?一勞永逸修改mysql字符集!MySql
- mysql 字符集造成的效能問題MySql
- Mysql之儲存引擎及字符集MySql儲存引擎
- mysql 下字符集知識彙總MySql
- MySQL架構優化之字符集MySql架構優化
- MySQL字符集概念及設定方法MySql
- mysql字符集檢視與設定MySql
- mysql 字符集 utf8 for solaris 10MySql
- mysql的字符集校對規則MySql
- 修改mysql預設字符集的方法MySql
- MySQL 4.1 字符集支援的原理(轉)MySql
- MySQL字符集亂碼與解決方案MySql
- MySQL檢視和修改字符集的方法MySql
- MySQL 檢視與修改預設字符集MySql
- MySQL修改表預設字符集行為MySql