MYSQL ×Ö·û¼¯¼°±àÂëÎÊÌâ
MySQLµÄ×Ö·û¼¯Ö§³Ö(Character Set Support)ÓÐÁ½¸ö·½Ã棺
×Ö·û¼¯(Character set)ºÍÁ¬½ÓУ¶Ô(Collation)¡£
¶ÔÓÚ×Ö·û¼¯µÄÖ§³Öϸ»¯µ½Ëĸö²ã´Î:
·þÎñÆ÷(server)£¬Êý¾Ý¿â(database)£¬Êý¾Ý±í(table)ºÍÁ¬½Ó(connection)¡£
1.MySQLĬÈÏ×Ö·û¼¯
MySQL¶ÔÓÚ×Ö·û¼¯µÄÖ¸¶¨¿ÉÒÔϸ»¯µ½Ò»¸öÊý¾Ý¿â£¬Ò»ÕÅ±í£¬Ò»ÁУ¬Ó¦¸ÃÓÃʲô×Ö·û¼¯¡£
µ«ÊÇ£¬´«Í³µÄ³ÌÐòÔÚ´´½¨Êý¾Ý¿âºÍÊý¾Ý±íʱ²¢Ã»ÓÐʹÓÃÄÇô¸´ÔÓµÄÅäÖã¬ËüÃÇÓõÄÊÇĬÈϵÄÅäÖã¬ÄÇô£¬Ä¬ÈϵÄÅäÖôӺζøÀ´ÄØ£¿
(1)±àÒëMySQL ʱ£¬Ö¸¶¨ÁËÒ»¸öĬÈϵÄ×Ö·û¼¯£¬Õâ¸ö×Ö·û¼¯ÊÇ latin1£»
(2)°²×°MySQL ʱ£¬¿ÉÒÔÔÚÅäÖÃÎļþ (my.ini) ÖÐÖ¸¶¨Ò»¸öĬÈϵĵÄ×Ö·û¼¯£¬Èç¹ûûָ¶¨£¬Õâ¸öÖµ¼Ì³Ð×Ô±àÒëʱָ¶¨µÄ£»
(3)Æô¶¯mysqld ʱ£¬¿ÉÒÔÔÚÃüÁîÐвÎÊýÖÐÖ¸¶¨Ò»¸öĬÈϵĵÄ×Ö·û¼¯£¬Èç¹ûûָ¶¨£¬Õâ¸öÖµ¼Ì³Ð×ÔÅäÖÃÎļþÖеÄÅäÖÃ,´Ëʱ character_set_server ±»É趨ΪÕâ¸öĬÈϵÄ×Ö·û¼¯£»
(4)µ±´´½¨Ò»¸öеÄÊý¾Ý¿âʱ£¬³ý·ÇÃ÷È·Ö¸¶¨£¬Õâ¸öÊý¾Ý¿âµÄ×Ö·û¼¯±»È±Ê¡É趨Ϊcharacter_set_server£»
(5)µ±Ñ¡¶¨ÁËÒ»¸öÊý¾Ý¿âʱ£¬character_set_database ±»É趨ΪÕâ¸öÊý¾Ý¿âĬÈϵÄ×Ö·û¼¯£»
(6)ÔÚÕâ¸öÊý¾Ý¿âÀï´´½¨Ò»Õűíʱ£¬±íĬÈϵÄ×Ö·û¼¯±»É趨Ϊ character_set_database£¬Ò²¾ÍÊÇÕâ¸öÊý¾Ý¿âĬÈϵÄ×Ö·û¼¯£»
(7)µ±ÔÚ±íÄÚÉèÖÃÒ»À¸Ê±£¬³ý·ÇÃ÷È·Ö¸¶¨£¬·ñÔò´ËÀ¸È±Ê¡µÄ×Ö·û¼¯¾ÍÊDZíĬÈϵÄ×Ö·û¼¯£»
¼òµ¥µÄ×ܽáһϣ¬Èç¹ûʲôµØ·½¶¼²»Ð޸ģ¬ÄÇôËùÓеÄÊý¾Ý¿âµÄËùÓбíµÄËùÓÐÀ¸Î»µÄ¶¼Óà latin1 ´æ´¢£¬²»¹ýÎÒÃÇÈç¹û°²×° MySQL£¬Ò»°ã¶¼»áÑ¡Ôñ¶àÓïÑÔÖ§³Ö£¬Ò²¾ÍÊÇ˵£¬°²×°³ÌÐò»á×Ô¶¯ÔÚÅäÖÃÎļþÖÐ°Ñ default_character_set ÉèÖÃΪ UTF-8£¬Õâ±£Ö¤ÁËȱʡÇé¿öÏ£¬ËùÓеÄÊý¾Ý¿âµÄËùÓбíµÄËùÓÐÀ¸Î»µÄ¶¼Óà UTF-8 ´æ´¢¡£
2.²é¿´Ä¬ÈÏ×Ö·û¼¯(ĬÈÏÇé¿öÏ£¬mysqlµÄ×Ö·û¼¯ÊÇlatin1(ISO_8859_1)
ͨ³££¬²é¿´ÏµÍ³µÄ×Ö·û¼¯ºÍÅÅÐò·½Ê½µÄÉ趨¿ÉÒÔͨ¹ýÏÂÃæµÄÁ½ÌõÃüÁ
mysql> SHOW VARIABLES LIKE 'character%';
+--------------------------+---------------------------------+
| Variable_name | Value &
Ïà¹ØÎĵµ£º
ÎÞÏÞ·ÖÀàÊÇÎÒÃÇ¿ª·¢Öзdz£³£¼ûµÄÓ¦Óã¬ÏñÂÛ̳µÄµÄ°æ¿é£¬CMSµÄÀà±ð£¬Ó¦Óõĵط½Ìرð¶à¡£
ÎÒÃÇ×î³£¼û×î¼òµ¥µÄ·½·¨¾ÍÊÇÔÚMySqlÀïID ,parentID,name£º
ÓŵãÊǼòµ¥£¬½á¹¹¼òµ¥¡£
ȱµãÊÇЧÂʲ»¸ß£¬ÒòΪÿһ´ÎµÝ¹é¶¼Òª²éѯÊý¾Ý¿â£¬¼¸°ÙÌõÊý¾Ý¿âʱ¾Í²»ÊǺܿìÁË£¡
´æ´¢Ê÷ÊÇÒ»ÖÖ³£¼ûµÄÎÊÌ⣬¶àÖÖ½â¾ö·½°¸¡£Ö÷ÒªÓÐÁ½ÖÖ·½·¨£ºÁÚ½Ó±íµ ......
MySqlÊý¾Ý¿âµÄÁÐÀàÐÍ£¨×Ö¶ÎÀàÐÍ)
MySQLÊý¾Ý¿âµÄ±íÊÇÒ»¸ö¶þά±í£¬ÓÉÒ»¸ö»ò¶à¸öÊý¾ÝÁй¹³É¡£
ÿ¸öÊý¾ÝÁж¼ÓÐËüµÄÌض¨ÀàÐÍ£¬¸ÃÀàÐ;ö¶¨ÁËMySQLÈçºÎ¿´´ý¸ÃÁÐÊý¾Ý£¬ÎÒÃÇ¿ÉÒÔ°ÑÕûÐÍÊýÖµ´æ·Åµ½×Ö·ûÀàÐ͵ÄÁÐÖУ¬MySQLÔò»á°ÑËü¿´³É×Ö·û´®À´´¦Àí¡£
MySQLÖеÄÁÐÀàÐÍÓÐÈýÖÖ£ºÊýÖµÀà¡¢×Ö·û´®ÀàºÍÈÕÆÚ/ʱ¼äÀà¡£
´Ó´óÀàÀ´¿´ÁÐÀàÐͺÍÊýÖ ......
MysqlÔÚĬÈÏÇé¿öϽ¨Á¢±íµÄ×Ö·û±àÂëÊÇlatin1£¬ËùÒÔÔÚ²åÈëÖÐÎÄʱ»á³ö´í¡£
eg£º
1¡¢²é¿´±í½¨Á¢µÄsqlÔ´Â룺
1: sqlÃüÁshow create table users
2:
3: ½á¹û£º
4: CREATE TABLE `users` (
5: `userID` int(10) unsigned NOT NULL AUTO_INCREMENT,
6: `userName` varchar(4 ......
ÍøÉϺܶàVCÁ¬½ÓmysqlµÄÀý×Ó¶¼ÊÇÒª´ø¸ölibmysql.dll²ÅÄÜÕý³£Ê¹Óõġ£
µ«ÓÐʱÎÒÃDz¢²»Ïë¶à´ø¸ölibmysql.dll£¬Ö»Ïëµ¥Îļþ¾ÍÄÜʹÓûòÕßÄãÊÇÒª
·â×°ÔÚÒ»¸ödllÎļþÀÕâʱÄãÒª¾ÍÓõ½mysqlclient.libÕâ¸ö¾²Ì¬¿âÁË¡£
ʾÀý´úÂëÈçÏ£¬ºÜºÜ¼òµ¥£¬¾Í²»¶à˵ÁË¡£
Ïà¹ØµÄmysqlÍ·Îļþ¼°¾²Ì¬¿â£º
http://download.csdn.net/source/1047 ......