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

PHPÓëMySQL¿ª·¢ÖеÄ×Ö·û±àÂëÎÊÌâ

Ò»£®¹ØÓÚMySQLÊý¾Ý¿â·þÎñÆ÷
MySQL·þÎñÆ÷µÄĬÈϱàÂëÊÇLatin1£¬²»Ö§³ÖÖÐÎÄ£¬ÄÇôÈçºÎÐÞ¸ÄMySQLµÄĬÈϱàÂëÄØ£¬ÏÂÃæÒÔUTF-8ΪÀýÀ´ËµÃ÷¡£
1¡¢ÖÐÖ¹MySQL·þÎñ£¨bin/mysqladmin -u root shutdown£©
2¡¢ÔÚ/etc/ÏÂÕÒµ½my.cnf£¬Èç¹ûûÓоͰÑMySQLµÄ°²×°Ä¿Â¼ÏµÄsupport-filesĿ¼ÏµÄmy-medium.cnf¸´ÖƵ½/etc/ϲ¢¸ÄÃûΪmy.cnf¼´¿É
3¡¢´ò¿ªmy.cnfÒÔºó£¬ÔÚ[client]ºÍ[mysqld]ÏÂÃæ¾ù¼ÓÉÏdefault-character-set=utf8£¬±£´æ²¢¹Ø±Õ
4¡¢Æô¶¯MySQL·þÎñ£¨bin/mysqld_safe &£©·Ç³£¼òµ¥£¬ÕâÑùµÄÐÞ¸ÄÒ»ÀÍÓÀÒÝ£¬½ñºóMySQLÒ»ÇÐÏà¹ØµÄĬÈϱàÂë¾ùΪUTF-8ÁË£¬´´½¨Ð±í¸ñµÄʱºòÎÞÐèÔÙ´ÎÉèÖá£
¶þ£®PHP³ÌÐòÉè¼ÆÊ±Òª¿¼ÂǵÄ×Ö·û±àÂëÎÊÌâ
Ò»°ãÀ´Ëµ£¬ÂÒÂëµÄ³öÏÖÓÐ2ÖÖÔ­Òò£¬Ê×ÏÈÊÇÓÉÓÚ±àÂë(charset)ÉèÖôíÎ󣬵¼ÖÂä¯ÀÀÆ÷ÒÔ´íÎóµÄ±àÂëÀ´½âÎö£¬´Ó¶ø³öÏÖÁËÂúÆÁÂÒÆß°ËÔãµÄ“ÌìÊ锣¬ Æä´ÎÊÇÎļþ±»ÒÔ´íÎóµÄ±àÂë´ò¿ª£¬È»ºó±£´æ£¬±ÈÈçÒ»¸öÎı¾ÎļþÔ­ÏÈÊÇGB2312±àÂëµÄ£¬È´ÒÔUTF-8±àÂë´ò¿ªÔÙ±£´æ¡£Òª½â¾öÉÏÊöÂÒÂëÎÊÌ⣬Ê×ÏÈÐèÒªÖªµÀ ¿ª·¢ÖÐÄÄЩ»·½ÚÉæ¼°µ½Á˱àÂ룺
1¡¢Îļþ±àÂ룺ָµÄÊÇÒ³ÃæÎļþ(.html,.phpµÈ)±¾ÉíÊÇ ÒÔºÎÖÖ±àÂëÀ´±£´æµÄ¡£¼Çʱ¾ºÍDreamweaverÔÚ´ò¿ªÒ³ÃæÊ±ºò»á×Ô¶¯Ê¶±ðÎļþ±àÂëÒò¶ø²»Ì«»á³öÎÊÌâ¡£¶øZendStudioÈ´²»»á×Ô¶¯Ê¶±ð±àÂ룬Ëü Ö»»á¸ù¾ÝÊ×Ñ¡ÏîµÄÅäÖù̶¨ÒÔijÖÖ±àÂë´ò¿ªÎļþ£¬Èç¹û¹¤×÷ʱºòÒ»²»×¢Ò⣬ÓôíÎó±àÂë´ò¿ªÎļþ£¬×öÁËÐÞ¸ÄÖ®ºóÒ»±£´æ£¬ÂÒÂë¾Í³öÏÖÁË£¨ÎÒÉîÓÐÌå»á£©¡£
2¡¢Ò³ÃæÉêÃ÷±àÂ룺ÔÚHTML´úÂëHEADÀïÃæ£¬¿ÉÒÔ ÓÃ<meta http-equiv="Content-Type" content="text/html; charset="XXX" />À´¸æËßä¯ÀÀÆ÷ÍøÒ³²ÉÓÃÁËʲô±àÂ룬ĿǰÖÐÎÄÍøÕ¾¿ª·¢ÖÐXXXÖ÷ÒªÓõÄÊÇGB2312ºÍUTF-8Á½ÖÖ±àÂë¡£
3¡¢Êý¾Ý¿âÁ¬½Ó±àÂ룺ָµÄÊǽøÐÐÊý¾Ý¿â²Ù×÷ʱºòÒÔÄÄÖÖ±àÂëÓëÊý¾Ý¿â´«ÊäÊý¾Ý£¬ÕâÀïÐèҪעÒâµÄÊDz»ÒªÓëÊý¾Ý¿â±¾ÉíµÄ±àÂë»ìÏý£¬±ÈÈçMySQLÄÚ²¿Ä¬ÈÏÊÇlatin1±àÂ룬Ҳ¾ÍÊÇ˵MysqlÊÇÒÔlatin1±àÂëÀ´´æ´¢Êý¾Ý£¬ÒÔÆäËû±àÂë´«Ê䏸MysqlµÄÊý¾Ý»á±»×ª»»³Élatin1±àÂë¡£
ÖªµÀÁËWEB¿ª·¢ÖÐÄÄЩµØ·½Éæ¼°µ½Á˱àÂ룬Ҳ¾ÍÖªµÀÁËÂÒÂë²úÉúµÄÔ­Òò£ºÉÏÊö3Ïî±àÂëÉèÖò»Ò»Ö£¬ÓÉÓÚ¸÷ÖÖ±àÂë¾ø´ó²¿·ÖÊǼæÈÝASCIIµÄ£¬ËùÒÔÓ¢ÎÄ·ûºÅ²»»á³öÏÖ£¬ÖÐÎľ͵¹Ã¹ÁË¡£ÏÂÃæÊÇһЩ³£¼ûµÄ´íÎóÇé¿öÓë½â¾ö£º
1¡¢Êý¾Ý¿â²ÉÓÃUTF8±àÂ룬¶øÒ³ÃæÉêÃ÷±àÂëÊÇGB2312£¬ÕâÊÇ×î³£¼ûµÄ²úÉúÂÒÂëµÄÔ­Òò¡£ÕâʱºòÔÚPHP½Å±¾ÀïÃæÖ±½ÓSELECTÊý¾Ý³öÀ´µÄ¾ÍÊÇÂÒÂ룬ÐèÒªÔÚ²éѯǰÏÈʹÓãº
mysql_query("SET NAMES GBK");
À´É趨M


Ïà¹ØÎĵµ£º

MysqlÍü¼ÇrootÃÜÂëµÄ½â¾ö°ì·¨

ÔÚwindowsÏ£º
´ò¿ªÃüÁîÐд°¿Ú£¬Í£Ö¹mysql·þÎñ(»òÕßÔÚÈÎÎñ¹ÜÀíÆ÷Àï½áÊøµômysqld-nt.exe½ø³Ì)£º        Net stop mysql
Æô¶¯mysql£¬Ò»°ãµ½mysqlµÄ°²×°Â·¾¶£¬ÕÒµ½ mysqld-nt.exe
Ö´ÐУºmysqld-nt --skip-grant-tables
ÁíÍâ´ò¿ªÒ»¸öÃüÁîÐд°¿Ú£¬Ö´ÐÐmysql
use mysql
update us ......

VCÖÐÓÃADO²Ù×÷MySqlÊý¾Ý¿âÖÐÎÄÎÊÌâ

      ÎҵijÌÐòÊÇÓÃADOÀ´Á¬½ÓMysqÊý¾Ý¿âµÄ£¬ÕâÊÇÔ­ÏÈдºÃÓÃÔÚMSSQLÉϵ쬏ÄÁËÏÂÁ¬½Ó×Ö·û´®£¬ËùÒÔÒ²¾ÍûÓÐÓÃMySql C++ APIÀ´ÖØÐÂдÁË¡£¸Õ¿ªÊ¼Ê¹ÓÃMySql£¬Óöµ½µÄÎÊÌâ×ÜÊÇÌØ±ðµÄ¶à£¬ÏÖÔÚÓÖÓöµ½Ò»¸öÖ÷Òªsql×Ö·û´®ÖÐÓÐÖÐÎľͱ¨´íµÄÎÊÌ⣬ûÓÐÖÐÎÄÒ»ÇÐÕý³££¬ÕûÕûŪÁËÒ»¸öÉÏÎ磬ÔÚÍøÉÏÒ²ÕÒÁ˺ܶà×ÊÁÏ£¬·¢ ......

mysql³öÏÖunauthenticated user¼òµ¥·ÖÎöÒÔ¼°½â¾ö

µ±ÓÃshow processlist;¿´µ½ÈçÏÂÐÅϢʱ:
LL | login | NULL             |
| 697 | unauthenticated user | 218.26.219.186:26944  | NULL       | Connect | NULL | login | NULL      & ......

»ù´¡ JAVA¶ÔMysql½øÐÐÁ¬½Ó¡¢²åÈë¡¢Ð޸ġ¢É¾³ý²Ù×÷

Êý¾Ý¿â±íµ¥µÄ´´½¨
mysql> create database shuishengmu;
Query OK, 1 row affected (0.00 sec)
mysql> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql    & ......

¹úÄÚPHP¿ªÔ´½¨Õ¾³ÌÐòÒ»ÀÀ

¹úÍâµÄ¿ªÔ´¼¼ÊõÒ²Ó°ÏìºÍÍÆ¶¯Á˹úÄÚ¿ªÔ´³ÌÐòµÄ·¢Õ¹£¬ÉÏÎÄÎÒ½éÉܵġ¶¹úÍâÓÅÐ㿪ԴPHP½¨Õ¾³ÌÐòÒ»ÀÀ¡·ÖУ¬ºÜ¶à¹úÍ⿪Դ³ÌÐò²¢²»Ì«·ûºÏÖйúÈ˵ÄʹÓÃϰ¹ß£¬¶ø¹úÄÚÓÐһЩ³§¼Ò»ò¸öÈËÒ²×öÁËһЩ²»´íµÄ²úÆ·£¬²»ÉÙ³ÌÐòÊÇÌṩԴ´úÂëÏÂÔØµÄ£¬ËäÈ»ÓÐЩÔÚÐí¿ÉЭÒéÉϺͿªÔ´Ðí¿ÉÖ¤ÓÐЩ³öÈ룬µ«ÆäÔÚʹÓÃÉÏ»¹ÊÇͦ·ûºÏÖйúÈ˵ÄʹÓÃϰ¹ß£¬½ñÌìÎÒ¾ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ