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

MySQL .Íâ¼üÔ¼Êø

InnoDBÒ²Ö§³ÖÍâ¼üÔ¼Êø¡£InnoDBÖжÔÍâ¼üÔ¼Êø¶¨ÒåµÄÓï·¨¿´ÆðÀ´ÈçÏ£º
[CONSTRAINT symbol] FOREIGN KEY [id] (index_col_name, ...)
    REFERENCES tbl_name (index_col_name, ...)
    [ON DELETE {RESTRICT | CASCADE | SET NULL | NO ACTION}]
    [ON UPDATE {RESTRICT | CASCADE | SET NULL | NO ACTION}]
Íâ¼ü¶¨Òå·þ´ÓÏÂÁÐÇé¿ö£º
·         ËùÓÐtables±ØÐëÊÇInnoDBÐÍ£¬ËüÃDz»ÄÜÊÇÁÙʱ±í¡£
·         ÔÚÒýÓñíÖУ¬±ØÐëÓÐÒ»¸öË÷Òý£¬Íâ¼üÁÐÒÔͬÑùµÄ˳Ðò±»ÁÐÔÚÆäÖÐ×÷ΪµÚÒ»ÁС£ÕâÑùÒ»¸öË÷ÒýÈç¹û²»´æÔÚ£¬Ëü±ØÐëÔÚÒýÓñíÀï±»×Ô¶¯´´½¨¡£
·         ÔÚÒýÓñíÖУ¬±ØÐëÓÐÒ»¸öË÷Òý£¬±»ÒýÓõÄÁÐÒÔͬÑùµÄ˳Ðò±»ÁÐÔÚÆäÖÐ×÷ΪµÚÒ»ÁС£
·         ²»Ö§³Ö¶ÔÍâ¼üÁеÄË÷Òýǰ׺¡£ÕâÑùµÄºó¹ûÖ®Ò»ÊÇBLOBºÍTEXTÁв»±»°üÀ¨ÔÚÒ»¸öÍâ¼üÖУ¬ÕâÊÇÒòΪ¶ÔÕâЩÁеÄË÷Òý±ØÐë×ÜÊÇ°üº¬Ò»¸öǰ׺³¤¶È¡£
·         Èç¹ûCONSTRAINTsymbol±»¸ø³ö£¬ËüÔÚÊý¾Ý¿âÀï±ØÐëÊÇΨһµÄ¡£Èç¹ûËüûÓб»¸ø³ö£¬InnoDB×Ô¶¯´´½¨Õâ¸öÃû×Ö¡£
InnoDB¾Ü¾øÈκÎÊÔ×ÅÔÚ×Ó±í´´½¨Ò»¸öÍâ¼üÖµ¶ø²»Æ¥ÅäÔÚ¸¸±íÖеĺòÑ¡¼üÖµµÄINSERT»òUPDATE²Ù×÷¡£Ò»¸ö¸¸±íÓÐһЩƥÅäµÄÐеÄ×Ó±í£¬InnoDB¶ÔÈκÎÊÔͼ¸üлòɾ³ý¸Ã¸¸±íÖкòÑ¡¼üÖµµÄUPDATE»òDELETE²Ù×÷ÓÐËù¶¯×÷£¬Õâ¸ö¶¯×÷È¡¾öÓÚÓÃFOREIGN KEY×Ó¾äµÄON UPDATEºÍON DETETE×Ó¾äÖ¸¶¨µÄreferential action¡£µ±Óû§ÊÔͼ´ÓÒ»¸ö¸¸±íɾ³ý»ò¸üÐÂÒ»ÐÐ֮ʱ£¬ÇÒÔÚ×Ó±íÖÐÓÐÒ»¸ö»ò¶à¸öÆ¥ÅäµÄÐУ¬InnoDB¸ù¾ÝÒª²ÉÈ¡µÄ¶¯×÷ÓÐÎå¸öÑ¡Ôñ£º
·         CASCADE: ´Ó¸¸±íɾ³ý»ò¸üÐÂÇÒ×Ô¶¯É¾³ý»ò¸üÐÂ×Ó±íÖÐÆ¥ÅäµÄÐС£ON DELETE CASCADEºÍON UPDATE CASCADE¶¼¿ÉÓá£ÔÚÁ½¸ö±íÖ®¼ä£¬Äã²»Ó¦¶¨ÒåÈô¸ÉÔÚ¸¸±í»ò×Ó±íÖеÄͬһÁвÉÈ¡¶¯×÷µÄON UPDATE CASCADE×Ӿ䡣
·         SET NULL: ´Ó¸¸±íɾ³ý»ò¸üÐÂÐУ¬²¢ÉèÖÃ×Ó±íÖеÄÍâ¼üÁÐΪNULL¡£Èç¹ûÍâ¼üÁÐûÓÐÖ¸¶¨NOT NULLÏÞ¶¨´Ê£¬Õâ¾ÍÊÇΨһºÏ·¨µÄ¡£ON DELETE SET NULLºÍON UPDATE SET NULL×Ӿ䱻֧³Ö¡£
·     


Ïà¹ØÎĵµ£º

¾ßÓиºÔؾùºâ¹¦ÄÜMySQL·þÎñÆ÷¼¯Èº²¿ÊðʵÏÖ

À´×Ô£ºhttp://it.china-b.com/zx/linuxsjk/20090525/24129_1.html
ÕªÒª£ºMySQLÊÇÒ»¸ö¸ßËٶȡ¢¸ßÐÔÄÜ¡¢¶àÏ̵߳ĹØϵÐÍÊý¾Ý¿â
ÖÎÀíϵͳ£¬ÊÊÓÃƽ̨¶à£¬¿ÉÀ©Õ¹ÐÔÇ¿¡£ÔÚʵ¼ÊÉú²ú»·¾³ÖУ¬²¿ÊðºÍʵÏÖ¾ßÓÐÒ»¶¨¸ºÔؾùºâ¹¦ÄܵÄMySQL·þÎñÆ÷¼¯Èº£¬¶ÔÓÚÌá¸ßÓû§Êý¾Ý¿â
Ó¦ÓÃϵͳµÄÐÔÄÜ¡¢ËٶȺÍÎȶ¨ÐÔ¾ßÓÐÃ÷ÏÔµÄ×÷Óᣱ¾ÎļòÒª½éÉÜÁËÔÚ ......

[C++]MySQLÊý¾Ý¿â²Ù×÷ʵÀý

»·¾³ÉèÖãº
°²×°ÍêMySQLÖ®ºó£¬½«°²×°Ä¿Â¼ÖеÄincludeĿ¼ÏµÄlibmysql.libÎļþ¿½µ½VS2008°²×°Ä¿Â¼ÖеÄVC\lib\Ï£¬È»ºóÔÚ ÏîÄ¿-Ñ¡Ïî-c/c++-³£¹æ Öеĸ½¼Ó°üº¬Ä¿Â¼ÒÔ¼° Á´½ÓÆ÷-³£¹æ Öеĸ½¼Ó¿âĿ¼ÖмÓÈë“c:\MySQL\include\”£¬²¢ÇÒÔÚ Á´½ÓÆ÷-ÊäÈë Öеĸ½¼ÓÒÀÀµÏîÄÚÌí¼Ó“lib ......

java¶ÔmysqlÊý¾Ý¿âµÄµ¼Èëµ¼³ö

//µ¼³ö
String mysql="mysqldump -uroot -proot  --opt databasename > d:/test.sql";    
java.lang.Runtime.getRuntime().exec("cmd /c "+mysql);   
//µ¼Èë
String mysql="mysqladmin -uroot -proot create databasename";    
java.lang.Runt ......

ÔÚMYSQLÖвåÈ뵱ǰʱ¼ä

NOW()º¯ÊýÒÔ`'YYYY-MM-DD HH:MM:SS'·µ»Øµ±Ç°µÄÈÕÆÚʱ¼ä£¬¿ÉÒÔÖ±½Ó´æµ½DATETIME×Ö¶ÎÖС£
CURDATE()ÒÔ’YYYY-MM-DD’µÄ¸ñʽ·µ»Ø½ñÌìµÄÈÕÆÚ£¬¿ÉÒÔÖ±½Ó´æµ½DATE×Ö¶ÎÖС£
CURTIME()ÒÔ’HH:MM:SS’µÄ¸ñʽ·µ»Øµ±Ç°µÄʱ¼ä£¬¿ÉÒÔÖ±½Ó´æµ½TIME×Ö¶ÎÖС£
Àý£ºinsert ......

ÔÚUbuntuÖÐͨ¹ýÔ´Âë°²×°±àÒë°²×°Èí¼þ(MySQLƪ)

        ʹÓÃUbuntu
Server×÷Ϊ±¾µØ²âÊÔ»·¾³ÒѾ­ÓÐÒ»¶Îʱ¼äÁË£¬Ò»Ö±¶¼ÊÇʹÓÃapt-get·½Ê½À´°²×°¸÷ÖÖÓ¦ÓÃÈí¼þ£¬Í¨¹ýÔ´Âë±àÒë°²×°Ó¦ÓÃÈí¼þÊÇLinuxºÍUnix»·
¾³ÏÂ×î³£Óõķ½Ê½¡£Í¨¹ýÔ´Âë±àÒë°²×°µÄ×î´óºÃ´¦¾ÍÊÇÄãÖªµÀ×Ô¼º×öÁËʲô£¬ÕâÖÖ·½Ê½°²×°Èí¼þ×ÔÓÉÁé»î£¬Ò²ÊÊÓÃÓÚ¸÷ÖÖƽ̨¡¢Î¬»¤·½±ã£ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ