mysql 資料庫字符集和排序規則修改

2021-09-28 15:56:41 字數 757 閱讀 7061

--- 修改資料庫字符集和排序規則

alter database xc character set utf8 collate utf8_general_ci;

--- 檢視資料庫的字符集

select * from information_schema.schemata where schema_name = 'db_name';

--- 修改表預設的字符集

alter table table_name character set gbk collate gbk_bin;

--- 修改表資料的字符集

alter table table_name convert to character set gbk collate gbk_bin;

--- 檢視表的字符集

select * from information_schema.tables where table_schema = 'db_name' and table_name = 'table_name';

--- 修改欄位的字符集

alter table table_name change column_name varchar(50) character set gbk collate gbk_bin;

--- 檢視欄位的字符集

select * from information_schema.columns where table_schema = 'db_name' and table_name = 'table_name';

MySQL新建資料庫 字符集 排序規則

排序規則 亂序問題 有過新建過的資料庫的小夥伴對這張圖肯定不陌生了,但關於字符集和排序規則一般是直接忽略呢,還是有去了解,然後根據自身業務特點設定相應字符集或者排序規則?以上圖為例子,我是基於mysql8.0新建對的,然後字符集和排序規則都不設定,新建後,你會發現mysql預設設定為如下值 字符集 ...

mysql 字符集排序 mysql字符集和排序規則

1.關於字符集和排序規則 所為字符集,就是用來定義字元在資料庫中的編碼的集合。常見的字符集有 utf8 支援中文 和accis 不支援中文 資料庫中的排序規則用來定義字元在進行排序和比較的時候的一種規則。常見的如下 1 utf8 general ci 不區分大小寫,utf8 general cs 區...

mysql 字符集排序 MySQL字符集和排序介紹

客服端字符集 character set client utf8mb4 連線字符集 character set connectionutf8mb4 資料庫字符集 character set databaseutf8mb4 檔案系統字符集 character set filesystembinary ...