1. 程式人生 > 其它 >Kubernetes 部署常見應用

Kubernetes 部署常見應用

MySQL字符集

------------------- ------------- Linux系統字符集編碼 ------------------------------ ------------------

#1.命令列臨時修改 : 
LANG=us_EN.UTF-8
LANG=zh_CN.UTF-8
 
臨時修改報錯命令為應文 : LANG=us_EN.UTF-8

#2.修改系統字符集
  Centos6 永久修改:[root@localhost ~]# vim /etc/sysconfig/i18n
  Centos7 永久修改:[root@localhost ~]# vim /etc/locale.conf


--------- ---------------- -----------   MySQL  --------------- ------------------------ -----------

編譯之前指定
cmake .
-DDEFAULT_CHARSET=UTF8 \
-DDEFAULT_COLLATION=UTF8_GENERAL_CI
配置檔案指定

#1.修改配置檔案
[mysqld]
character-set-server=utf8
collation-server=utf8_general_ci
 
[client]
default-character-set=utf8
[mysql]
default-character-set=utf8
 
#2. 重啟服務

#3. 檢視修改結果:
mysql> show variables like '%char%';
+--------------------------+----------------------------+
| Variable_name            | Value                      |
+--------------------------+----------------------------+
| character_set_client     | utf8                       |
| character_set_connection | utf8                       |
| character_set_database   | latin1                     |
| character_set_filesystem | binary                     |
| character_set_results    | utf8                       |
| character_set_server     | latin1                     |
| character_set_system     | utf8                       |
| character_sets_dir       | /usr/share/mysql/charsets/ |
+--------------------------+----------------------------+
8 rows in set (0.07 sec)


校驗規則: utf8_general_ci
  1)ci:大小寫不敏感
  2)cs或bin:大小寫敏感
 
#一個表裡面不可能出現同名不同大小寫的欄位
 
#檢視校驗規則
mysql> show collation;
+--------------------------+----------+-----+---------+----------+---------+
| Collation                | Charset  | Id  | Default | Compiled | Sortlen |
+--------------------------+----------+-----+---------+----------+---------+
| big5_chinese_ci          | big5     |   1 | Yes     | Yes      |       1 |
| big5_bin                 | big5     |  84 |         | Yes      |       1 |
| dec8_swedish_ci          | dec8     |   3 | Yes     | Yes      |       1 |
| dec8_bin                 | dec8     |  69 |         | Yes      |       1 |
.........


utf8和utf8mb4之間的區別?
  utf8不支援emoji表情而utf8mb4支援。
通過SQL語句指定字符集編碼

#建立資料庫指定字符集和校驗規則
create database db1 charset utf8mb4 collate utf8mb4_general_ci;