ÔÚMYSQLÖвåÈ뵱ǰʱ¼ä
NOW()º¯ÊýÒÔ`'YYYY-MM-DD HH:MM:SS'·µ»Øµ±Ç°µÄÈÕÆÚʱ¼ä£¬¿ÉÒÔÖ±½Ó´æµ½DATETIME×Ö¶ÎÖС£
CURDATE()ÒÔ’YYYY-MM-DD’µÄ¸ñʽ·µ»Ø½ñÌìµÄÈÕÆÚ£¬¿ÉÒÔÖ±½Ó´æµ½DATE×Ö¶ÎÖС£
CURTIME()ÒÔ’HH:MM:SS’µÄ¸ñʽ·µ»Øµ±Ç°µÄʱ¼ä£¬¿ÉÒÔÖ±½Ó´æµ½TIME×Ö¶ÎÖС£
Àý£ºinsert into tablename (fieldname) values (now())
Ïà¹ØÎĵµ£º
1.INµÄÓ÷¨
IN(value,value1,...) valuesµÄ¸öÊý¸úmax_allowed_packetÏà¹Ø£¬SELECT 2 IN (2,4,'STRING');
NOT IN(value,..)ºÍINÓï·¨Ò»Ñù¡£
2.IF NOT EXISTS
CREATE ... IF NOT EXISTS stm; ...¿ÉÒÔʹDATABASE,TABLE,EVENT¡£ÈçCREATE TABLE IF NOT EXISTS t(id INT);
3.MD5,MySQLÊý¾Ý¿âÌṩÁËmd5¼ÓÃܹ¦Ä ......
mysqlÊÇÒ»¸öÓÅÐãµÄ¿ªÔ´Êý¾Ý¿â£¬ËüÏÖÔÚµÄÓ¦Ó÷dz£µÄ¹ã·º£¬Òò´ËºÜÓбØÒª¼òµ¥µÄ½éÉÜÒ»ÏÂÓÃpython²Ù×÷mysqlÊý¾Ý¿âµÄ·½·¨¡£python²Ù×÷Êý¾Ý¿âÐèÒª°²×°Ò»¸öµÚÈý·½µÄÄ£¿é£¬ÔÚhttp://mysql-python.sourceforge.net/
ÓÐÏÂÔغÍÎĵµ¡£
ÓÉÓÚpythonµÄÊý¾Ý¿âÄ£¿éÓÐרÃŵÄÊý¾Ý¿âÄ£¿éµÄ¹æ·¶£¬ËùÒÔ£¬Æäʵ²»¹ÜʹÓÃÄÄÖÖÊý¾ ......
ERROR 1005 (HY000): Can't create table ' ****.frm' (errno: 150)
ÎÒÊÇ´ÓÒÔϼ¸¸ö·½Ãæ½â¾öÁË´ËÎÊÌ⣺
1¡¢È·±£²ÎÕյıíºÍ×Ö¶ÎÊÇ´æÔڵģ»
2¡¢×é³ÉÍâ¼üµÄ×Ö¶ÎÒªÇó±»Ë÷Òý(Ö÷ÒªÊÇÍâ¼üÄǸö×Ö¶ÎÒªÇóÔÚÆäËû±íÖÐÊÇÖ÷¼ü)£»
3¡¢Íâ¼ü¹ØÁªµÄÁ½±í»ò¶à±íÒªÇó¶¼ÊÇINNODBÀàÐÍµÄ±í£»
4¡¢×Ö¶ÎÀàÐÍ£¨ËµÃ÷£©ÒªÒ»Ñù`itemId` varchar( ......
select * for updateËø±íµÄÎÊÌâ
ÓÉÓÚInnoDBÔ¤ÉèÊÇRow-Level Lock£¬ËùÒÔÖ»ÓС¸Ã÷È·¡¹µÄÖ¸¶¨Ö÷¼ü£¬MySQL²Å»áÖ´ÐÐRow lock (Ö»Ëøס±»Ñ¡È¡µÄ×ÊÁÏÀý) £¬·ñÔòMySQL½«»áÖ´ÐÐTable Lock (½«Õû¸ö×ÊÁÏ±íµ¥¸øËøס)¡£
¾Ù¸öÀý×Ó:
¼ÙÉèÓиö±íµ¥products £¬ÀïÃæÓÐid¸úname¶þ¸öÀ¸Î»£¬idÊÇÖ÷¼ü¡£
Àý1: (Ã÷È·Ö¸¶¨Ö÷¼ü£¬²¢ÇÒÓд˱Ê×ÊÁÏ£¬ ......
MySQL5.X¶¼ÒѾ·¢²¼ºÃ¾ÃÁË£¬µ«ÊÇ»¹ÓкܶàÈËÈÏΪMySQLÊDz»Ö§³ÖÊÂÎñ´¦ÀíµÄ£¬Õâ²»µÃ²»¹ÖËûÃÇÊǹª¹ÑÎŵģ¬Æäʵ£¬Ö»ÒªÄãµÄMySQL°æ±¾
Ö§³ÖBDB»òInnoDB±íÀàÐÍ£¬ÄÇôÄãµÄMySQL¾Í¾ßÓÐÊÂÎñ´¦ÀíµÄÄÜÁ¦¡£ÕâÀïÃ棬ÓÖÒÔInnoDB±íÀàÐÍÓõÄ×î¶à£¬ËäÈ»ºóÀ´·¢ÉúÁËÖîÈçOracleÊÕ
¹ºInnoDBµÈÁîMySQL²»Ë¬µÄÊÂÇ飬µ«ÄÇЩÉÌÒµÉϵĶ·ÕùÓë¼¼ÊõÎ޹أ ......