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

MySQLÁÙʱ±í½¨Á¢

MySQL½¨Á¢ÁÙʱ±íµÄÓï¾äÈçÏÂ:
CREATE TEMPORARY TABLE tmp (
article INT(4) UNSIGNED ZEROFILL DEFAULT '0000' NOT NULL,
price DOUBLE(16,2) DEFAULT '0.00' NOT NULL);
--LOCK TABLES article read;
--ÏȲåÈëÊý¾Ýµ½ÁÙʱ±í
INSERT INTO tmp SELECT article, MAX(price) from shop GROUP BY article;
--²éѯÁÙʱ±íÊý¾Ý
SELECT article, dealer, price from shop, tmpWHERE shop.article=tmp.articel AND shop.price=tmp.price;
--UNLOCK TABLES;
DROP TABLE tmp;


Ïà¹ØÎĵµ£º

Mysql´æ´¢¹ý³Ì£¨Î壩——SEQUENCEµÄʵÏÖ

ÔÚ
oracle
ÖУ¬
sequence
Ìṩ¶à±í¶à×ֶοɹ²ÓÃÒ»¸ö²»Öظ´Öµ¡£
Mysql
ÖдæÔÚ×ÔÔöÁУ¬»ù±¾¿ÉÒÔÂú×ã
PK
µÄÒªÇó¡£µ«×ÔÔöÁдæÔÚÏÞÖÆ£º
a.
Ö»ÄÜÓÃÓÚ±íÖеÄÒ»¸ö×ֶΣ¬Ò»ÕŲ»ÄÜͬʱ´æÔÚÁ½¸öÒÔÉϵÄ×ÔÔöÁÐ
;
b.
×ÔÔöÁбØÐë±»¶¨ÒåΪ
key
£¨
PK
»ò
FK
£©
;
c.
×ÔÔöÁв»Äܱ»¶à¸ö±í¹²ÓÃ
;
d.
µ±
insert
Óï¾ä² ......

MysqlÈÎÎñµ÷¶È£¨Event£©

<!-- [if gte mso 10]>
MySQL5.1.x
°æ±¾ÖÐÒýÈëÁËÒ»ÏîÐÂÌØÐÔ
EVENT
£¬¹ËÃû˼Òå¾ÍÊÇʼþ¡¢¶¨Ê±ÈÎÎñ»úÖÆ£¬ÔÚÖ¸¶¨µÄʱ¼äµ¥ÔªÄÚÖ´ÐÐÌض¨µÄÈÎÎñ£¬Òò´Ë½ñºóһЩ¶ÔÊý¾Ý¶¨Ê±ÐÔ²Ù×÷²»ÔÙÒÀÀµÍⲿ³ÌÐò£¬¶øÖ±½ÓʹÓÃÊý¾Ý¿â±¾ÉíÌṩµÄ¹¦ÄÜ¡£´Ë¹¦ÄÜÊǶÔ
Oracle
µÄ
Job/Schedule
µÄÄ£·Â£¬
5.1.X
°æ±¾ÒÔÉϲÅÖ§³Ö¡£
 & ......

show innodb status (mysql)


µ±Ç°»îÔ¾µÄÊÂÎñ:
------------
TRANSACTIONS
------------
Trx id counter080157601
Purge done for trx's n:o <0 80154573 undo n:o <0 0
History list length 6
Total number of lock structs in row lock hash table 0
LIST OF TRANSACTIONS FOR EACH SESSION:
---TRANSACTION 0 0, not started, proce ......

mysql ¶¨Ê±Êý¾Ý±¸·Ý

1.±àдshell½Å±¾
vi /data/www/project_name/bin/mysql_backup.sh
#!/bin/bash
#This is a ShellScript For Auto DB Backup
#Powered by liuzheng

#ϵͳ±äÁ¿¶¨Òå
DBName=test
DBUser=root
DBPasswd=123456
BackupPath=/tmp/mysql_backup/

NewFile="$BackupPath"db$(date +%y%m%d ......

mysql innodb ÐÔÄÜÓÅ»¯

ĬÈÏÇé¿öÏ£¬innodbµÄ²ÎÊýÉèÖõķdz£Ð¡£¬ÔÚÉú²ú»·¾³ÖÐÔ¶Ô¶²»¹»ÓÃ
±ÈÈç×îÖØÒªµÄÁ½¸ö²ÎÊý
innodb_buffer_pool_size
ĬÈÏÊÇ8M
innodb_flush_logs_at_trx_commit ĬÈÏÉèÖõÄÊÇ1 Ò²¾ÍÊÇͬ²½Ë¢ÐÂlog(¿ÉÒÔÕâôÀí½â)
innodb_buffer_pool_size£º
ÕâÊÇInnoDB×îÖØÒªµÄÉèÖ㬶ÔInnoDBÐÔÄÜÓоö¶¨ÐÔµÄÓ°Ï졣ĬÈϵÄÉèÖÃÖ»ÓÐ8M£¬ËùÒÔ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ