MySQLµÄtimestampÀàÐÍ×Ô¶¯¸üÐÂÎÊÌâ
×¢£º±¾ÎÄÌÖÂ۵ķ¶Î§ÎªÎ´ÆôÓÃMAXDBģʽµÄ±í£¡
½ñÌ콨ÁËÒ»¸ö±í£¬ÀïÃæÓÐÒ»¸öÁÐÊÇtimestampÀàÐÍ£¬ÎÒ±¾ÒâÊÇÔÚÊý¾Ý¸üÐÂʱ£¬Õâ¸ö×ֶεÄʱ¼äÄÜ×Ô¶¯¸üС£ÆñÖª¶ÔÕâ¸öÀàÐ͵ÄÖµ»¹²»ÉõÁ˽⣬µ¼Ö³ö´í¡£·¢ÏÖÕâ¸ö×Ö¶ÎÖ»ÊÇÔÚÕâÐÐÊý¾Ý½¨Á¢µÄʱºòÓÐÖµ£¬ÔÚ¸üеÄÈ´Îޱ仯¡£
²éÕÒ×ÊÁÏ£¬·¢ÏÖÊÇÎÒ½¨±íµÄÓï¾äÓÐÎÊÌ⣺
ÒÔÏÂÊÇ´úÂëƬ¶Î£º
CREATE TABLE `test` (
`t1` timestamp NOT NULL default CURRENT_TIMESTAMP,
`ww` varchar(5) NOT NULL
) ENGINE=MyISAM ;
¶øʵ¼ÊÉÏ£¬ÒÔÏÂÁ½¸ö½¨±íÓï¾äµÄЧ¹ûÊÇÒ»ÑùµÄ£º
ÒÔÏÂÊÇ´úÂëƬ¶Î£º
CREATE TABLE `test` (
`t1` TIMESTAMP NOT NULL ,
`ww` VARCHAR( 5 ) NOT NULL
) ENGINE = MYISAMCREATE TABLE `test` (
`t1` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,
`ww` varchar(5) NOT NULL
) ENGINE=MyISAM ;
±È½Ï֮ϣ¬ÎÒµÄÓï¾äÉÙÁË“on update CURRENT_TIMESTAMP”»ò¶àÁË“default CURRENT_TIMESTAMP”¡£Èç´ËÒ»À´£¬Õâ¸ötimestamp×Ö¶ÎÖ»ÊÇÔÚÊý¾ÝinsertµÄʱ¼ä½¨Á¢Ê±¼ä£¬¶øupdateʱ¾Í²»»áÓб仯ÁË¡£µ±È»£¬Èç¹ûÄã¾ÍÊÇÏë´ïµ½Õâ¸öÄ¿µÄµ¹Ò²ÎÞËùν¡£
²éÕÒÓ¢ÎÄÊֲᣨhttp://dev.mysql.com/doc/refman/5.1/en/timestamp.html£©£¬µÃµ½¸üÏêϸµÄ½â˵£¬·ÒëÈçÏ£º
———————————–·Ò뿪ʼ——————————–
ÔÚCREATE TABLEÓï¾äÖУ¬µÚ1¸öTIMESTAMPÁпÉÒÔÓÃÏÂÃæµÄÈκÎÒ»ÖÖ·½Ê½ÉùÃ÷£º
1£º Èç¹û¶¨ÒåʱDEFAULT CURRENT_TIMESTAMPºÍON UPDATE CURRENT_TIMESTAMP×Ӿ䶼ÓУ¬ÁÐֵΪĬÈÏʹÓõ±Ç°µÄʱ¼ä´Á£¬²¢ÇÒ×Ô¶¯¸üС£
2£º Èç¹û²»Ê¹ÓÃDEFAULT»òON UPDATE×Ӿ䣬ÄÇôËüµÈͬÓÚDEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP¡£
3£º Èç¹ûÖ»ÓÐDEFAULT CURRENT_TIMESTAMP×Ӿ䣬¶øûÓÐON UPDATE×Ӿ䣬ÁÐֵĬÈÏΪµ±Ç°Ê±¼ä´Áµ«²»×Ô¶¯¸üС£
4£º Èç¹ûûÓÃDEFAULT×Ӿ䣬µ«ÓÐON UPDATE CURRENT_TIMESTAMP×Ӿ䣬ÁÐĬÈÏΪ0²¢×Ô¶¯¸üС£
5£º Èç¹ûÓÐÒ»¸ö³£Á¿
Ïà¹ØÎĵµ£º
CREATE [OR REPLACE] [ALGORITHM = {UNDEFINED | MERGE | TEMPTABLE}]
VIEW view_name [(column_list)]
AS select_statement
[WITH [CASCADED | LOCAL] CHECK OPTION]
¸ÃÓï¾äÄÜ´´½¨ÐµÄÊÓͼ£¬Èç¹û¸ø¶¨ÁËOR REPLACE×Ӿ䣬¸ÃÓï¾ä»¹ÄÜÌæ»»ÒÑÓеÄÊÓͼ¡£s ......
×Ô¼º½â¾ö°ì·¨£ºÔÚmy.iniÖн«Á½´¦latin1¸Ä³Éutf8¼´¿É
Ò»¡¢ÂÒÂë²úÉúÔÒò
MySQL ×Ö·û±àÂëÊÇ°æ±¾4.1ÒýÈëµÄ£¬Ö§³Ö¶à¹úÓïÑÔ£¬¶øÇÒһЩÌØÐÔÒѾ³¬¹ýÁËÆäËü´ó¶àÊýÊý¾Ý¿â¹ÜÀíϵͳ¡£ÕýÒòΪÕâÒ»ÌØÐԲŵ¼Ö MySQL µÄÂÒÂëÎÊÌâ¡£
×Ö·û¼¯ÊÇÒ»Ì×·ûºÅºÍ±àÂ롣У¶Ô¹æÔòÊÇÔÚ×Ö·û¼¯ÄÚÓÃÓڱȽÏ×Ö·ûµÄÒ»Ì×¹æÔò¡£ÈÃÎÒÃÇʹÓÃÒ»¸ö¼ÙÏë×Ö·û ......
mysql Êý¾Ý¿âĬÈϵÄÁ¬½ÓÖ»ÄÜÔÚ±¾»úÁ¬½Ó£¬Ô¶³ÌÁ¬½Ó±ØÐëÊÚȨ¡£
´úÂë: È«Ñ¡
¡¡GRANT ALL PRIVILEGES ON *.* TO 'myuser'@'%'IDENTIFIED
BY 'mypassword' WITH GRANT
OPTION;Èç¹ûÄãÏëÔÊÐíÓû§myuser´ÓipΪ192.168.1.6µÄÖ÷»úÁ¬½Óµ½mysql·þÎñÆ÷£¬²¢Ê¹ÓÃ
mypassword×÷ΪÃÜÂë
´úÂë: GRANT ALL PR ......
Êý¾Ý¿â²Ù×÷ÀࣺDBCommon.class.php
//---------------------------------------------------------------------
// MySQL Master/SlaveÊý¾Ý¿â¶Áд²Ù×÷Àà
//
// ¿ª·¢×÷Õß: heiyeluren
// °æ±¾ÀúÊ·:
// 2006-09-20 »ù±¾µ¥Êý¾Ý¿â²Ù×÷¹¦ÄÜ, 25 ¸ö½Ó¿Ú
// 2007-07-30 Ö§³Öµ ......
Èç¹ûÒ»¸öMyISAM±í°üº¬Èκοɱ䳤¶ÈÁУ¨VARCHAR, BLOB»òTEXTDynamic£©£¬»òÕßÈç¹ûÒ»¸ö±í±»ÓÃROW_FORMAT=DYNAMICÑ¡ÏîÀ´´´½¨£¬¶¯Ì¬´æ´¢¸ñʽ±»Ê¹Óá£
Õâ¸ö¸ñʽ¸üΪ¸´ÔÓÒ»µã£¬ÒòΪÿÐÐÓÐÒ»¸ö±íÃ÷ÐÐÓж೤µÄÍ·¡£µ±Ò»¸ö¼Ç¼ÒòΪ¸üеĽá¹û±»±äµÃ¸ü³¤£¬¸Ã¼Ç¼Ҳ¿ÉÒÔÔÚ³¬¹ýÒ»¸öλÖô¦½áÊø¡£
Äã¿ÉÒÔʹÓÃOPTIMIZE TAB ......