新聞中心
以下的文章主要描述的是對(duì)MySQL 字符集的正確認(rèn)識(shí),我們大家都知道MySQL數(shù)據(jù)庫(kù)對(duì)于實(shí)際應(yīng)用字符集的指定其是可以細(xì)化到一個(gè)數(shù)據(jù)庫(kù),一張表,一列,應(yīng)該用什么字符集。MySQL字符集是理解過(guò)程 。

創(chuàng)新互聯(lián)建站是專業(yè)的秦都網(wǎng)站建設(shè)公司,秦都接單;提供成都網(wǎng)站建設(shè)、網(wǎng)站設(shè)計(jì),網(wǎng)頁(yè)設(shè)計(jì),網(wǎng)站設(shè)計(jì),建網(wǎng)站,PHP網(wǎng)站建設(shè)等專業(yè)做網(wǎng)站服務(wù);采用PHP框架,可快速的進(jìn)行秦都網(wǎng)站開(kāi)發(fā)網(wǎng)頁(yè)制作和功能擴(kuò)展;專業(yè)做搜索引擎喜愛(ài)的網(wǎng)站,專業(yè)的做網(wǎng)站團(tuán)隊(duì),希望更多企業(yè)前來(lái)合作!
(1)編譯MySQL 時(shí),指定了一個(gè)默認(rèn)的字符集,這個(gè)字符集是 latin1;
(2)安裝MySQL 時(shí),可以在配置文件 (my.ini) 中指定一個(gè)默認(rèn)的的字符集,如果沒(méi)指定,這個(gè)值繼承自編譯時(shí)指定的;
(3)啟動(dòng)MySQLd 時(shí),可以在命令行參數(shù)中指定一個(gè)默認(rèn)的的字符集,如果沒(méi)指定,這個(gè)值繼承自配置文件中的配置,此時(shí) character_set_server 被設(shè)定為這個(gè)默認(rèn)的字符集;
(4)當(dāng)創(chuàng)建一個(gè)新的數(shù)據(jù)庫(kù)時(shí),除非明確指定,這個(gè)數(shù)據(jù)庫(kù)的字符集被缺省設(shè)定為character_set_server;
(5)當(dāng)選定了一個(gè)數(shù)據(jù)庫(kù)時(shí),character_set_database 被設(shè)定為這個(gè)數(shù)據(jù)庫(kù)默認(rèn)的字符集;
(6)在這個(gè)數(shù)據(jù)庫(kù)里創(chuàng)建一張表時(shí),表默認(rèn)的字符集被設(shè)定為 character_set_database,也就是這個(gè)數(shù)據(jù)庫(kù)默認(rèn)的字符集;
(7)當(dāng)在表內(nèi)設(shè)置一欄時(shí),除非明確指定,否則此欄缺省的字符集就是表默認(rèn)的字符集;
3、MySQL字符集支持(Character Set Support)有兩個(gè)方面:
字符集(Character set)和排序方式(Collation)
4、對(duì)于字符集的支持細(xì)化到四個(gè)層次:
服務(wù)器(server),數(shù)據(jù)庫(kù)(database),數(shù)據(jù)表(table)和連接(connection)
5、查看系統(tǒng)的字符集和排序方式的設(shè)定可以通過(guò)下面的兩條命令:
- MySQL> SHOW VARIABLES LIKE 'character_set_%';
- +--------------------------+----------------------------+
- | Variable_name | Value |
- +--------------------------+----------------------------+
- character_set_client,utf8
- character_set_connection,utf8
- character_set_database,utf8
- character_set_filesystem,binary
- character_set_results,utf8
- character_set_server,utf8
- character_set_system,utf8
- character_sets_dir,D:\MySQL Server 5.0\share\charsets\
- MySQL> SHOW VARIABLES LIKE 'collation_%';
- +--------------------------+----------------------------+
- | Variable_name | Value |
- +--------------------------+----------------------------+
- collation_connection,utf8_general_ci
- collation_database,utf8_general_ci
- collation_server,utf8_general_ci
status 命令:
- MySQL>status;
- Server characterset: utf8
- Db characterset: utf8
- Client characterset: utf8
- Conn. characterset: utf8
以上的相關(guān)內(nèi)容就是對(duì)MySQL 字符集認(rèn)識(shí)的介紹,望你能有所收獲。
當(dāng)前文章:對(duì)MySQL字符集的正確認(rèn)識(shí)
網(wǎng)頁(yè)路徑:http://m.fisionsoft.com.cn/article/cdjjdhg.html


咨詢
建站咨詢
