mysql字符集編碼

2021-09-02 00:20:36 字數 1489 閱讀 3425

檢視編碼字符集:

show variables like』collation_%』;

show variables like』character_set_%』;

在命令列修改字元編碼(例如gb3212):

set character_set_client=gb2312;客戶端編碼方式

set character_set_connection= gb2312;建立連線使用的編碼

set character_set_database= gb2312;資料庫的編碼

set character_set_results= gb2312;結果集的編碼

set character_set_server= gb2312;資料庫伺服器的編碼

保證上面五個採用的編碼方式一樣,就不會出現亂碼問題。

set character_set_system= gb2312;

set collation_connection= gb2312;

set collation_database= gb2312;

set collation_server= gb2312;

檢視當前會話的隔離級別

select @@tx_isolation;

設定此會話的隔離級別read committed

set  session transaction isolation level read committed;

設定全域性的隔離級別為read committed

set  global transaction isolation level read committed;

query_cache_min_res_unit

這個數值越高表示 query cache 的 fragment 狀況越嚴重,通常它會界於 10%~20% 之間。在此範例中

block fragmnt 為 13.05%,這是可接受的情況,當然你也可以調整 query_cache_min_res_unit 的值來降低

block fragmnt。

sql_no_cache

在乙個高度穩定的 query cache 中,insrt 的值應該要高於 prune 的值;反之,在乙個揮發性較高(較不穩定)的 query cache 中,這個比值將會是 1:1 或是偏重在prune 那方,這表示 query cache 中的資料有可能在使用到之前就已經被清除了。我們會希望擁有乙個穩定的 query cache,因為穩定的 query cache 表示那些被 cache 在 query cache 中的資料會常被用到。高揮發性(較不穩定)的query cache 代表兩件事情:第一,query cache 設得太小,需要加大。第二,mysql 正試圖要 cache 所有的東西,甚至是那些其實並不需要 cache 的資料。若是第一種狀況,只要單純的加大 query cache 即可。若是第二種情況,可能是 mysql 試圖要去 cache 所有可以 cache 的資料,你可以使用 sql_no_cache 來明確的告訴 mysql 什麼資料是你不想要 cache 的。

mysql 字符集編碼 mysql的字元編碼

可以通過show variables like character 來輸出當前字元編碼情況 可得到如下結果 mysql show variables like character variable name value character set client gbk 注 客戶端編碼 想從win下的...

MySQL字符集編碼問題

今天專案中,用中斷命令匯入sql指令碼,發現其報出編碼錯誤,後來進過一番分析查詢後,發現字符集utf8mb4在mysql 5.5.3之後才支援,頓時無語,隨後改字符集編碼為utf8。注意 查詢mysql版本命令 mysql v mysql命令 1 使用show語句找出在伺服器上當前存在什麼資料庫 m...

mysql 修改字符集編碼

一,異常資訊 hy000 1366 incorrect string value xe5 xb0 x8f xe5 x8d x96.for column shop name at row 1 1,檢視table 編碼 2,解決 a alter table shop default character ...