Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

mysql ÂÒÂëÎÊÌâ¡£

show variables like 'character%';²é¿´×Ö·û±àÂë
--¸ü¸Ä×Ö·û¼¯
SET character_set_client = utf-8 ;
SET character_set_connection = utf-8 ;
SET character_set_database = utf-8 ;
SET character_set_results = utf-8 ;
SET character_set_server = utf-8 ;
SET collation_connection = utf8 ;
SET collation_database = utf8 ;
SET collation_server = utf8 ;
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%';
+------------------------


Ïà¹ØÎĵµ£º

Mysql ÊÂÎñ´¦Àí

¡¡¡¡ÊÂÎñÊÇDBMSµÃÖ´Ðе¥Î»¡£ËüÓÉÓÐÏÞµÃÊý¾Ý¿â²Ù×÷ÐòÁÐ×é³ÉµÃ¡£µ«²»ÊÇÈÎÒâµÃÊý¾Ý¿â²Ù×÷ÐòÁж¼ÄܳÉΪÊÂÎñ¡£Ò»°ãÀ´Ëµ£¬ÊÂÎñÊDZØÐëÂú×ã4¸öÌõ¼þ£º£¨ACID£©
¡¡¡¡Ô­×ÓÐÔ£¨Autmic£©£ºÊÂÎñÔÚÖ´ÐÐÐÔ£¬Òª×öµ½“Ҫô²»×ö£¬ÒªÃ´È«×ö£¡”£¬¾ÍÊÇ˵²»ÔÊÐíÊÂÎñ²¿·ÖµÃÖ´ÐС£¼´Ê¹ÒòΪ¹ÊÕ϶øʹÊÂÎñ²»ÄÜÍê³É£¬ÔÚrollbackʱҲҪÏû³ý¶ÔÊ ......

ʹÓÃmysqlµÄreplaceº¯ÊýÌæ»»×Ö·û´®

×î½üÔÚÑо¿CMS£¬ÔÚÊý¾Ýת»»µÄʱºòÐèÒªÓõ½mysqlµÄreplaceº¯Êý£¬ÕâÀï¼òµ¥½éÉÜһϣ¡
±ÈÈçÄãÒª½« ±í tb1ÀïÃæµÄ f1×ֶεÄabcÌ滻Ϊdef
UPDATE tb1 SET f1=REPLACE(f1, 'abc', 'def');
REPLACE(str,from_str,to_str)   
ÔÚ×Ö·û´®   str   ÖÐËùÓгöÏÖµÄ×Ö·û´®   from_str&nbs ......

mysql c ½Ó¿Ú´óÈ«


MYSQLÔÚ C API ÖпÉÓõĺ¯Êý£º
mysql_affected_rows()
·µ»Ø±»×îеÄUPDATE, DELETE»òINSERT²éѯӰÏìµÄÐÐÊý¡£
mysql_close()
¹Ø±ÕÒ»¸ö·þÎñÆ÷Á¬½Ó¡£
mysql_connect()
Á¬½ÓÒ»¸öMySQL·þÎñÆ÷¡£¸Ãº¯Êý²»ÍƼö£»Ê¹ÓÃmysql_real_connect()´úÌæ¡£
mysql_change_user()
¸Ä±äÔÚÒ»¸ö´ò¿ªµÄÁ¬½ÓÉϵÄÓû§ºÍÊý¾Ý¿â¡£
mysql_ ......

Web¿ª·¢±Ê¼Ç2——MySQLÊ°Áã

½ö½öÊÇ¿´Ò»Ð©ÊéÊÇÁãÁãɢɢ¼Çϵģ¬¸ø×Ô¼º±¸Íü¶øÒÑ¡£½¨ÒéÈ¥¿´×¨ÒµÍøÕ¾µÄ±Ê¼Ç¡£
1.Ö÷¼üµÄÖµ±ØÐëÊÇΨһµÄ£¬²¢ÇÒ²»ÄÜΪ¿Õ£¬Õâ¿ÉÒÔÌá¸ßMySQL´Ó¶à¸ö±íÖÐÈ¡µÃÊý¾Ý»òÕßÈ¡µÃÖ¸¶¨¼üÖµ¶ÔÓ¦µÄÐеÄËٶȡ£MySQLͨ¹ýÒ»¸öÌØÊâµÄ³ÆΪIndexË÷ÒýµÄÊý¾Ý½á¹¹×öµ½ÕâÒ»µã£¬IndexÊÇÕÒµ½Ò»Ìõ¼Ç¼µÄ¿ì½Ý·½Ê½£¬¾ÍÏñͼÊé¹ÝµÄ¿¨Æ¬Ä¿Â¼¡£
2.²é¿´±íµÄÁж¨ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ