mysql 設定輸入的字符集

2021-07-02 05:16:15 字數 1379 閱讀 7454

檢視所有字符集:show character set;

檢視所有校對集:show collation;

show collation like 'utf8%';檢視utf8中的校對集

set character_set_connection=gbk;

set character_set_results=gbk;

set character_set_client=gbk;

如果以上三者都為字符集n,則可以簡寫為set names n;該語句告訴伺服器將來從這個客戶端傳來的資訊採用字符集。

create table (

)charset utf8 collate utf8_general_ci;

修改資料庫的字符集

mysql>use mydb

mysql>alter database mydb character set utf-8;

建立資料庫指定資料庫的字符集

mysql>create database mydb character set utf-8;

通過mysql命令列修改:

mysql> set character_set_client=utf8;

query ok, 0 rows affected (0.00 sec)

mysql> set character_set_connection=utf8;

query ok, 0 rows affected (0.00 sec)

mysql> set character_set_database=utf8;

query ok, 0 rows affected (0.00 sec)

mysql> set character_set_results=utf8;

query ok, 0 rows affected (0.00 sec)

mysql> set character_set_server=utf8;

query ok, 0 rows affected (0.00 sec)

mysql> set character_set_system=utf8;

query ok, 0 rows affected (0.01 sec)

mysql> set collation_connection=utf8;

query ok, 0 rows affected (0.01 sec)

mysql> set collation_database=utf8;

query ok, 0 rows affected (0.01 sec)

mysql> set collation_server=utf8;

query ok, 0 rows affected (0.01 sec)

mysql字符集設定

show variables like char show variables like collation 2.修改編碼 set variable name value set character set connection utf8 3 顯示建立資料庫資訊 show create databa...

mysql 字符集設定

1.檢視mysql能夠支援的多種字符集 show character set 檢視mysql能夠支援的字符集的校對規則 show collation show collation like utf8 2.檢視當前字符集及校對 show variables like character set sho...

MySQL字符集設定

一 mysql字符集設定 1 系統變數 character set server 預設的內部操作字符集 character set client 客戶端 資料使用的字符集 character set connection 連線層字符集 character set results 查詢結果字符集 ch...