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

MySQL ÖÐÎÄÏÔʾÂÒÂë

MySQL ÖÐÎÄÏÔʾÂÒÂë
Èç¹ûÄãÓöµ½ÂÒÂëÎÊÌ⣬¿ÉÒÔ´ÓÏÂÃ漸¸öÎÊÌâÖð²½¼ì²é£º
£¨1£©¼ì²éÄãµÄÎļþ´æ´¢±àÂëÊÇ·ñºÍ meta ÉùÃ÷µÄÒ»Ö£¬¼ÙÈçÄãµÄÎļþÊÇ°´ÕÕ utf-8 ±àÂë´æ´¢£¬µ«ÊÇ meta È´ÉùÃ÷Ϊ gb2312 £¬½«µ¼ÖÂÂÒÂë¡£
½â¾ö°ì·¨£º½«Ò³Ãæ´æ´¢±àÂëºÍ meta ÉùÃ÷±£³ÖÒ»Ö¡£ÓüÇʱ¾´ò¿ªÎļþ£¬“Áí´æΪ”£¬ÏÂÃæÓиöÑ¡ÏîÊÇ“±àÂ딣¬Ñ¡ÔñºÍ meta ÉùÃ÷Ò»ÖµıàÂ뷽ʽ¡£(Ìáʾ£ºmeta µÄ±àÂëÉùÃ÷Òª·ÅÔÚ title ±êÇ©Ç°Ã棬·ñÔòÈÝÒ×µ¼ÖÂÒ³Ãæ¿Õ°×¡£)
£¨2£©¼ì²éÄãµÄÊý¾Ý¿âÁ¬½ÓÓÐûÓÐÉèÖÃÁ¬½Ó·½Ê½£¨SET NAMES£©£¬MySQL 4.1 °æ±¾ÒÔºó£¬Èç¹ûÄãûÓÐÉèÖÃÊý¾Ý¿âÁ¬½Ó·½Ê½£¬ÄÇô²åÈë»òÕß²éѯ½«³öÏÖÂÒÂëÇé¿ö¡£
½â¾ö°ì·¨£ºÔÚÄãµÄÊý¾Ý¿âÁ¬½ÓÉèÖÃΪ£º
ÔÚhibernate.cfg.xmlÖÐÓ¦¸ÃÕâÑùд
<property name="connection.url">jdbc:mysql://localhost:3306/test?useUnicode=true&amp;characterEncoding=UTF-8</property>
Èç¹ûÓÃhibernate.properties
#hibernate.connection.url jdbc:mysql://localhost:3306/test?useUnicode=true&characterEncoding=UTF-8
ÆäÖРutf8 ÐèÒª¸ù¾ÝÄãÐèÒªÉèÖá£
£¨3£©¼ì²éÄãµÄÒ³Ãæ±àÂë¡¢meta ÉùÃ÷¡¢Êý¾Ý¿âÁ¬½Ó·½Ê½£¨SET NAMES£©ÊÇ·ñÒ»Ö£¬Èç¹ûÄãµÄÒ³ÃæºÍmetaÉèÖÃΪgb2312£¬µ«ÊÇÈ´ÔÚ³ÌÐòÖÐÉèÖàSET NAMES utf8£¬Í¬Ñù»áµ¼ÖÂÂÒÂë¡£Ô­ÒòÊÇÈç¹ûÒ³ÃæÉèÖÃΪ gb2312 £¬ÄÇô±íµ¥ÖеÄÊý¾ÝÒ²ÊÇ°´ÕÕ gb2312 Ìá½»£¬µ«ÊdzÌÐòÈ´ÒªÇó°´ÕÕ utf8 È¥´¦Àí£¬½á¹û×ÔÈ»ÊÇÂÒÂë¡£
½â¾ö°ì·¨£º½«Ò³Ãæ±àÂë¡¢meta ÉùÃ÷¡¢Êý¾Ý¿âÁ¬½Ó·½Ê½£¨SET NAMES£©±£³ÖÒ»Ö£¬µ±È»ÕâÀï˵µÄÒ»Ö²»ÊǾø¶ÔµÄ£¬Èç MySQL µÄ utf8 ºÍÒ³ÃæÖеĠutf-8 ÊDz»Ò»ÑùµÄ£¬¾ßÌåÒª¸ù¾ÝÄãµÄʵ¼ÊÇé¿öÉèÖá£


Ïà¹ØÎĵµ£º

Mysql my.ini ÅäÖÃÎļþÏê½â

Mysql my.ini ÅäÖÃÎļþÏê½â
#BEGIN CONFIG INFO
#DESCR: 4GB RAM, ֻʹÓÃInnoDB, ACID, ÉÙÁ¿µÄÁ¬½Ó, ¶ÓÁиºÔØ´ó
#TYPE: SYSTEM
#END CONFIG INFO
#
# ´ËmysqlÅäÖÃÎļþÀý×ÓÕë¶Ô4GÄÚ´æ
# Ö÷ҪʹÓÃINNODB
#´¦Àí¸´ÔÓ¶ÓÁв¢ÇÒÁ¬½ÓÊýÁ¿½ÏÉÙµÄmysql·þÎñÆ÷
#
# ½«´ËÎļþ¸´ÖƵ½/etc/my.cnf ×÷Ϊȫ¾ÖÉèÖÃ,
# mysql-data-d ......

mysql¹ØÓÚÍøÉÏÁ÷תµÄ£¬Éú³É£³£¬£¶Ö®¼äµÄËæ»úÕûÊý

Èç¹ûÄãËÑË÷GOOGLE£¬Äã»áÕÒµ½ºÜ¶à¹ØÓÚmysqlµÄËæ»úÊý£¬ËûÃÇ»áÕâÑù˵
Éú³É£³£¬£¶Ö®¼äµÄËæ»úÕûÊý
FLOOR(3 + (RAND() * 6))
ÔÚ4ºóÃæÌí¼ÓÒ»¸ö3µ½6Ö®¼äµÄÕûÊý
CONCAT(343,FLOOR(3 + (RAND() * 6)))
ÔÚijһ×ֶκóÃæÌí¼Óһλ£³£¬£¶Ö®¼äµÄÕûÊý
UPDATE test SET xx= CONCAT(xx,FLOOR(3 +(RAND() * 6)));
µ«ÊÇÎÒ˽×Ô²âÊÔÁËһϣ¬ ......

MYSQL×Ô´ø¹¤¾ßQuery ProfilerʹÓÃ

Query ProfilerÊÇMYSQL×Ô´øµÄÒ»ÖÖqueryÕï¶Ï·ÖÎö¹¤¾ß£¬Í¨¹ýËü¿ÉÒÔ·ÖÎö³öÒ»ÌõSQLÓï¾äµÄÐÔÄÜÆ¿¾±ÔÚʲôµØ·½¡£Í¨³£ÎÒÃÇÊÇʹÓõÄexplain,ÒÔ¼°slow query log¶¼ÎÞ·¨×öµ½¾«È··ÖÎö£¬µ«ÊÇQuery ProfilerÈ´¿ÉÒÔ¶¨Î»³öÒ»ÌõSQLÓï¾äÖ´Ðеĸ÷ÖÖ×ÊÔ´ÏûºÄÇé¿ö£¬±ÈÈçCPU£¬IOµÈ£¬ÒÔ¼°¸ÃSQLÖ´ÐÐËùºÄ·ÑµÄʱ¼äµÈ¡£²»¹ý¸Ã¹¤¾ßÖ»ÓÐÔÚMYSQL 5.0.37ÒÔ ......

pythonÄ£¿éÖ®MySQLdb: ÓÃpythonÁ¬½ÓmysqlÊý¾Ý¿â

mysqlÊÇÒ»¸öÓÅÐãµÄ¿ªÔ´Êý¾Ý¿â£¬ËüÏÖÔÚµÄÓ¦Ó÷dz£µÄ¹ã·º£¬Òò´ËºÜÓбØÒª¼òµ¥µÄ½éÉÜÒ»ÏÂÓÃpython²Ù×÷mysqlÊý¾Ý¿âµÄ·½·¨¡£python²Ù×÷Êý¾Ý¿âÐèÒª°²×°Ò»¸öµÚÈý·½µÄÄ£¿é£¬ÔÚhttp://mysql-python.sourceforge.net/
ÓÐÏÂÔغÍÎĵµ¡£
    ÓÉÓÚpythonµÄÊý¾Ý¿âÄ£¿éÓÐרÃŵÄÊý¾Ý¿âÄ£¿éµÄ¹æ·¶£¬ËùÒÔ£¬Æäʵ²»¹ÜʹÓÃÄÄÖÖÊý¾ ......

mysql errno: 150 ´íÎó Íâ¼ü

ERROR 1005 (HY000): Can't create table '  ****.frm' (errno: 150)
ÎÒÊÇ´ÓÒÔϼ¸¸ö·½Ãæ½â¾öÁË´ËÎÊÌ⣺
1¡¢È·±£²ÎÕյıíºÍ×Ö¶ÎÊÇ´æÔڵģ»
2¡¢×é³ÉÍâ¼üµÄ×Ö¶ÎÒªÇó±»Ë÷Òý(Ö÷ÒªÊÇÍâ¼üÄǸö×Ö¶ÎÒªÇóÔÚÆäËû±íÖÐÊÇÖ÷¼ü)£»
3¡¢Íâ¼ü¹ØÁªµÄÁ½±í»ò¶à±íÒªÇó¶¼ÊÇINNODBÀàÐÍµÄ±í£»
4¡¢×Ö¶ÎÀàÐÍ£¨ËµÃ÷£©ÒªÒ»Ñù`itemId` varchar( ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ