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

MySQLʹÓô¥·¢³ÌÐò

´¥·¢³ÌÐòÊÇÓë±íÓйصÄÃüÃûÊý¾Ý¿â¶ÔÏ󣬵±±íÉϳöÏÖÌض¨Ê¼þʱ£¬½«¼¤»î¸Ã¶ÔÏó¡£ÔÚijЩ´¥·¢³ÌÐòµÄÓ÷¨ÖУ¬¿ÉÓÃÓÚ¼ì²é²åÈëµ½±íÖеÄÖµ£¬»ò¶Ô¸üÐÂÉæ¼°µÄÖµ½øÐмÆËã¡£
´¥·¢³ÌÐòÓë±íÏà¹Ø£¬µ±¶Ô±íÖ´ÐÐINSERT¡¢DELETE»òUPDATEÓï¾äʱ£¬½«¼¤»î´¥·¢³ÌÐò¡£¿ÉÒÔ½«´¥·¢³ÌÐòÉèÖÃΪÔÚÖ´ÐÐÓï¾ä֮ǰ»òÖ®ºó¼¤»î¡£ÀýÈ磬¿ÉÒÔÔÚ´Ó±íÖÐɾ³ýÿһÐÐ֮ǰ£¬»òÔÚ¸üÐÂÁËÿһÐк󼤻·¢³ÌÐò¡£
ÒªÏë´´½¨´¥·¢³ÌÐò»òÉáÆú´¥·¢³ÌÐò£¬¿ÉʹÓÃCREATE TRIGGER»òDROP TRIGGERÓï¾ä
ÏÂÃæ¸ø³öÁË1¸ö¼òµ¥µÄʾÀý£¬ÔÚ¸ÃʾÀýÖУ¬Õë¶ÔINSERTÓï¾ä£¬½«´¥·¢³ÌÐòºÍ±í¹ØÁªÁËÆðÀ´¡£Æä×÷ÓÃÏ൱ÓÚÀÛ¼ÓÆ÷£¬Äܹ»½«²åÈë±íÖÐijһÁеÄÖµ¼ÓÆðÀ´¡£
ÔÚÏÂÃæµÄÓï¾äÖУ¬´´½¨ÁË1¸ö±í£¬²¢Îª±í´´½¨ÁË1¸ö´¥·¢³ÌÐò£º
mysql> CREATE TABLE account (acct_num INT, amount DECIMAL(10,2));
mysql> CREATE TRIGGER ins_sum BEFORE INSERT ON account
    -> FOR EACH ROW SET @sum = @sum + NEW.amount;
CREATE TRIGGERÓï¾ä´´½¨ÁËÓëÕË»§±íÏà¹ØµÄ¡¢ÃûΪins_sumµÄ´¥·¢³ÌÐò¡£Ëü»¹°üÀ¨Ò»Ð©×Ӿ䣬ÕâЩ×Ó¾äÖ¸¶¨ÁË´¥·¢³ÌÐò¼¤»îʱ¼ä¡¢´¥·¢³ÌÐòʼþ¡¢ÒÔ¼°¼¤»î´¥·¢³ÌÐòʱ×÷Щʲô£º
·         ¹Ø¼ü×ÖBEFOREÖ¸Ã÷ÁË´¥·¢³ÌÐòµÄ¶¯×÷ʱ¼ä¡£ÔÚ±¾ÀýÖУ¬Ó¦ÔÚ½«Ã¿Ò»ÐвåÈë±í֮ǰ¼¤»î´¥·¢³ÌÐò¡£ÕâÀàÔÊÐíµÄÆäËû¹Ø¼ü×ÖÊÇAFTER¡£
·         ¹Ø¼ü×ÖINSERTÖ¸Ã÷Á˼¤»î´¥·¢³ÌÐòµÄʼþ¡£ÔÚ±¾ÀýÖУ¬INSERTÓï¾ä½«µ¼Ö´¥·¢³ÌÐòµÄ¼¤»î¡£ÄãÒ²¿ÉÒÔΪDELETEºÍUPDATEÓï¾ä´´½¨´¥·¢³ÌÐò¡£
·         ¸úÔÚFOR EACH ROWºóÃæµÄÓï¾ä¶¨ÒåÁËÿ´Î¼¤»î´¥·¢³ÌÐòʱ½«Ö´ÐеijÌÐò£¬¶ÔÓÚÊÜ´¥·¢Óï¾äÓ°ÏìµÄÿһÐÐÖ´ÐÐÒ»´Î¡£ÔÚ±¾ÀýÖУ¬´¥·¢µÄÓï¾äÊǼòµ¥µÄSETÓï¾ä£¬¸ºÔ𽫲åÈëamountÁеÄÖµ¼ÓÆðÀ´¡£¸ÃÓï¾ä½«ÁÐÒýÓÃΪNEW.amount£¬Òâ˼ÊÇ“½«Òª²åÈëµ½ÐÂÐеÄamountÁеÄÖµ”¡£
ÒªÏëʹÓô¥·¢³ÌÐò£¬½«ÀÛ¼ÓÆ÷±äÁ¿ÉèÖÃΪ0£¬Ö´ÐÐINSERTÓï¾ä£¬È»ºó²é¿´±äÁ¿µÄÖµ£º
mysql> SET @sum = 0;
mysql> INSERT INTO account VALUES(137,14.98),(141,1937.50),(97,-100.00);
mysql> SELECT @sum AS 'Total amount inserted';
+-----------------------+
| Total amount inserted |
+-----------------------+
| 1852.48            


Ïà¹ØÎĵµ£º

mysqlÓÃjdbcÁ¬½Ó

Ê×ÏÈ·ÅÖúÃjdbcÇý¶¯³ÌÐò£¬ÔÚ java\jre6\lib\ext\Ï£¬java\jdk1.6\jre\libµÈµØ·½¶¼·ÅÆðÀ´£¬ÒòΪ²»È·¶¨ÔÚÄÄÀïÓÐÓ÷··
Class.forName("com.mysql.jdbc.Driver").newInstance();
 String url = "jdbc:mysql://localhost/DATABASENAME?user=USERNAME&password=PASSWORD&useUnicode=tru ......

mysql Êý¾Ý´æ´¢×ܽá

ÓÉÓÚ×î½üÒ»Ö±ÔÚÁ˽âmysql¡£¸÷ÖÖ±íÀàÐ͵ÄÊý¾Ý´æ´¢ÒÔ¼°Ïà¹ØÏÞÖƾÍÊDZØÐëÁ˽âµÄ·½ÃæÁË¡£
×Ô¼ºµÄ·þÎñÆ÷»·¾³£ºOS Cent OS ext3£¬memory 4G£¬ disk 2T block size 4K¡£
¾­µ÷²é£¬linuxÏÂÎļþ×î´óÊÇ´æÔÚÏÞÖƵġ£È¥googleÉÏËÑÁËËÑ£¬´ó¼Ò˵·¨²»Ò»£¬×îÖÕ×Ô¼º»¹ÊÇÕÒµ½±È½Ï¹Ù·½µÄ˵¡£Ïê¼ûhttp://en.wikipedia.org/wiki/Ext3 ËùÒÔ× ......

mysqlÎļþµ¼ÈëÂÒÂëÎÊÌâµÄ½â¾ö£º

mysqlÎļþµ¼ÈëÂÒÂëÎÊÌâµÄ½â¾ö£º
1 ÃüÁî²ì¿´×Ö·ûÉèÖá£
mysql> show   variables   like   "%char%";
2 ½«²»ÊÇutf-8µÄ¶¼¸Ä³Éutf8¡£Ö»ÓÐfilesystem²»±ä;
| Variable_name            | Value
   &nb ......

linux mysql ÂÒÂëÎÊÌâ

 ½ñÌìÔÚÊý¾Ý¿âÖвåÈëÁËÖÐÎÄ£¬·¢ÏÖÓеÄÊÇÂÒÂ룬ÓеIJ»ÊÇ£¬ºÜÊÇÄÉÃÆ¡£
×îºóÕÒµ½Á˽â¾ö°ì·¨£º
´ò¿ª /etc/mysql/my.cnf
ÔÚ£Ûmysqld]ºÍ£Ûclient]½ÚÏ·ֱðÌí¼Ó:
default-character-set = utf8
È»ºóÖØÐÂÆô¶¯mysql£¬ÐèҪעÒâµÄÊÇ£¬¶ÔÐÞ¸ÄÒÔÇ°´´½¨µÄÊý¾Ý¿âÀ´Ëµ£¬ËûµÄ×Ö·û¼¯»¹ÊÇÔ­À´µÄ£¬ËùÒÔ»¹ÊÇ»á³öÏÖÂÒÂí£¬¶øд´½¨µÄÊý¾Ý ......

mysql°²×°Í¼½â½Ì³Ì 5.1(ת)

mysql°²×°Í¼½â½Ì³Ì 5.1
2009Äê03ÔÂ01ÈÕ ÐÇÆÚÈÕ 23:51
תÔØÇë×¢Ã÷³ö´¦:http://hi.baidu.com/herdff/blog/item/6e6b4bcf6132f90b93457e14.html
±¾½Ì³ÌÒÔMysql 5.1°æ±¾ÎªÀý£¬¸ü¸ß°æ±¾°²×°¹ý³ÌÓë´ËÀàËÆ¡£ÔĶÁÇ°£¬ÇëÏÂÔØ5.1£¬ÏÂÔصØÖ·£ºwww.mysql.com
°²×°¹ý³ÌÓëÆäËüWindows°²×°³ÌÐòÒ»Ñù£¬Ê×ÏȳöÏÖµÄÊÇ°²×°Ïòµ¼»¶Ó­½çÃæ
Ö ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ