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
- 2020重新出發,MySql基礎,MySql字符集MySql
- mysql亂碼?一勞永逸修改mysql字符集!MySql
- mysql 字符集造成的效能問題MySql
- Mysql之儲存引擎及字符集MySql儲存引擎
- MySQL字符集亂碼與解決方案MySql
- MySQL修改表預設字符集行為MySql
- MySQL檢視和修改字符集的方法MySql
- MySQL 檢視與修改預設字符集MySql
- mysql關於字符集character set的總結MySql
- mysql 解決字符集錯誤 正確摘錄MySql
- 關於mysql字符集及排序規則設定MySql排序
- 為Zabbix MySQL修改字符集排序utf8_binMySql排序
- MYSQL 字符集不同引起的join無法走索引MySql索引
- MySQL字符集和校對規則(character set & collation)MySql
- MySQL 5.7 版本的 UTF8 字符集調研MySql
- MySQL 字符集與亂碼與collation設定的問題?MySql
- 從根上理解 MySQL 的字符集和比較規則MySql
- MYSQL字符集問題1267 Illegal mix of collations (utf8_gMySql
- 字符集
- linux mysql5.7以上設定中文字符集不在/mysql/my.cnf下面了LinuxMySql
- Tomcat字符集Tomcat
- 深入理解Emoji(一) —— 字符集,字符集編碼
- 38、字符集_2(匯出匯入指定字符集)
- MySQL運維實戰(5.6) 字符集設定對mysqldump的影響MySql運維
- 關於mysql查詢字符集不匹配問題的解決方法MySql
- 故障分析 | MySQL convert 函式導致的字符集報錯處理MySql函式
- Oracle 字符集修改Oracle
- 修改sqlserver字符集SQLServer
- 更新Linux字符集Linux
- 批次修改欄位字符集和表表字符集,sql生成SQL
- MYSQL 5.7 升級 8.0 後的 由於字符集導致的大問題 ?MySql
- 4.2.1.4 選擇字符集
- 字符集與編碼
- 《Oracle MySQL程式設計自學與面試指南》05:字符集和校對集OracleMySql程式設計面試