《MYSQL數據庫mysql字符集設置查看方法》要點:
本文介紹了MYSQL數據庫mysql字符集設置查看方法,希望對您有用。如果有疑問,可以聯系我們。
導讀:本節內容:mysql設置字符集的方法1,列出mysql支持的所有字符集:
show character set;2,當前mysql服務器字符集設置
show variables lik...
本節內容:
mysql設置字符集的方法MYSQL應用
1,列出mysql支持的所有字符集:
?MYSQL應用
show character set;
2,當前mysql服務器字符集設置
?MYSQL應用
show variables like 'character_set_%';
3,當前mysql服務器字符集校驗設置
?MYSQL應用
show variables like 'collation_%';
4,顯示某數據庫字符集設置
?MYSQL應用
show create database 數據庫名;
5,顯示某數據表字符集設置
?MYSQL應用
show create table 表名;
6,修改數據庫字符集
?MYSQL應用
alter database 數據庫名default character set 'utf8';
7,修改數據表字符集
?MYSQL應用
alter table 表名default character set 'utf8';
8,建庫時指定字符集
?MYSQL應用
create database 數據庫名character set gbk collate gbk_chinese_ci;
9,建表時指定字符集
?MYSQL應用
create table `mysqlcode` (
`id` tinyint( 255 ) unsigned not null auto_increment primary key ,
`content` varchar( 255 ) not null
) type = myisam character set gbk collate gbk_chinese_ci;
數據庫字符集,在my.cnf中缺少如下代碼:
?MYSQL應用
[client]
default-character-set=utf8
[mysqld]
default-character-set=utf8
?
如果不加以上代碼,即使mysql編譯安裝時指定的編碼是utf8,在建庫時其默認編碼仍是latin1,而由于字符集的繼承性,庫中的表也是latin1的了.MYSQL應用
程序拜訪數據url參數:
jdbc:mysql://localhost:3306/testcharacter?autoreconnect=true&useunicode=yes&characterencoding=utf8MYSQL應用
維易PHP培訓學院每天發布《MYSQL數據庫mysql字符集設置查看方法》等實戰技能,PHP、MYSQL、LINUX、APP、JS,CSS全面培養人才。
轉載請注明本頁網址:
http://www.fzlkiss.com/jiaocheng/7414.html