MySQLÔÓ
MySQLµÄtimestampÀàÐÍ×Ô¶¯¸üÐÂÎÊÌâ
½ñÌ콨ÁËÒ»¸ö±í£¬ÀïÃæÓÐÒ»¸öÁÐÊÇ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£º Èç¹ûÓÐÒ»¸ö³£Á¿ÖµDEFAULT£¬¸ÃÁлáÓÐÒ»¸öĬÈÏÖ
Ïà¹ØÎĵµ£º
--default-character-set=utf8 ÓëÐÞ¸ÄsqlÎļþ¼ÓÈ룺SET NAMES 'utf8';
µ¼Èë½Å±¾Ê±£¬SET NAMES 'xxx' £¬xxxÓ¦¸ÃºÍsql½Å±¾ÎļþµÄʵ¼Ê±àÂëÒ»Ö£¬Èç¹ûÄãÉèÖõÄʱutf-8 £¬ÄÇôÇëÈ·ÈÏÄãµÄsql½Å±¾Îļþʱutf-8±£´æµÄ:
iconv -f UTF-8 xxx.sql
Èç¹ûÏÔʾÕý³££¬ÄÇôÕâÒ»²½¾ÍOKÁË
ÁíÍâ×¢ÒâÄãµÄ½Å±¾ÀÓÐûÓиø¿â±íÉèÖ ......
ºÜ¾ÃûÓÐÓÃMysqlÁË£¬·¢ÏÖССµÄʱ¼äÎÊÌâÒ²Óöµ½²»ÉÙÂé·³£¬ºÇºÇ
ËùÒÔ×ܽáһϣº
µÚÒ»ÖÖ:
Date time= new java.sql.Date(new java.util.Date().getTime());
µÚ¶þÖÖ:
java ÓÃPreparedStatementÀ´setDate,ÓÃÎʺŵÄÐÎʽ¸øÈÕÆÚÎʺŸ³Öµ
pstmt.setTimestamp(8, new Timestamp(System.currentTimeMillis()));
pst ......
my.iniÀïµÄÄǸötmp_table_sizeµÄÖµ.ÔÀ´tmp_table_size=16M.ÎÒ¸ÄΪ32M
È»ºóÖØÆôMYSQL»¹ÊÇû½â¾öÎÊÌâ.
Ö»ºÃÖØÆô·þÎñÆ÷ÊÔÊÔÁË,½á¹ûÖØÆôºóCPUÕý³£ÁË.²»¹ý»¹ÊÇûÕÒ³öÊÇʲôÔÒòµ¼ÖÂMYSQLÕ¼ÓÃÄÇô¶àCPU×ÊÔ´.
=====================================
ÐÞ¸ÄhostsÎļþ£¬¼ÓÈëÒ»ÐÐ
172.16.59.12 & ......
linux:
Èç¹û MySQL ÕýÔÚÔËÐУ¬Ê×ÏÈɱ֮£º killall -TERM mysqld¡£
Æô¶¯ MySQL £º/usr/bin/safe_mysqld --skip-grant-tables &
¾Í¿ÉÒÔ²»ÐèÒªÃÜÂë¾Í½øÈë MySQL ÁË¡£
È»ºó¾ÍÊÇ
>use mysql
>update user set password=password("new_pass") where user="root";
>flush privileges;
ÖØÐÂɱ MySQL £¬ ......
=== ÉÔºóÔÙÕûÀí
mysql
4.0µ½mysql
5.0µÄÊý¾Ýµ¼Èë³öÏÖÂÒÂëµÄ½â¾ö·½°¸
×ÖÌå´óС£º´ó
| ÖÐ
| С
2007-02-08 17:09 -
ÔĶÁ£º485 - ÆÀÂÛ
£º0
×î½ü×ömysql
4.0µ½mysql
5.0µÄÊý¾Ýת»¯¹¤×÷£¬·¢ÏÖÂÒÂë
ÎÞÊý£¬¹Û²©¿ÍÎÞÊýÐĵÃÈçÏ£º
£ªmysql
ÖÐÎÄ亂碼µÄÔÒò
mysql
會³ö現ÖÐÎÄ ......