創建數據庫怎么設置為gbk格式?
、更改服務器的編碼方式,在終端輸入以下命令:
mysqld --character-set-server=gbk --collation-server=gbk_chinese_ci;
2、更改某個數據庫的編碼方式
mysql -u root -p
alter database character set gbk collate gbk_chinese_ci;
3、在創建數據庫時指定編碼:
mysql -u root -p
create database db_name character set gbk collate gbk_chinese_ci;
4、更改某個表的編碼方式
mysql -u root -p db_name
alter table table_name convert to charachter set gbk collate gbk_chinese_ci;
5、在創建表時指定編碼方式
mysql -u root -p db_name
create table table_name (....) character set gbk collate gbk_chinese_ci;
6、更改某行的編碼方式
mysql -u root -p db_name
alter table table_name modify column_name varchar(20) character set gbk collate gbk_chinese_ci;
7、在創建列時指定編碼方式:
mysql -u root -p db_name
create table table_name (..., col1 varchar(20) character set gbk collate gbk_chinese_ci, ...) character set utf8 collate utf8_general_ci;