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

mysql ¹²ÏíËø ÅÅËûËø ·À²åÈëËø

ÊÔÑé1
ÊÂÎñ1£º
#!/usr/bin/python
import time
import MySQLdb;
conn = MySQLdb.connect(host="localhost",port=3306,user="root",passwd="asdf",db="test",unix_socket="/data/mysql_3306/mysql.sock")
cursor = conn.cursor()
cursor.execute("select * from test")
while str!="1":
    str = raw_input()
cursor.execute("update test id=id-1")
while str!="exit":
    str = raw_input()
cursor.close()
conn.close()
ÔÚmysqlÃüÁîÐÐÖÐÊäÈëÒÔÏ£º
mysql> select * from test;
µ±ÊÂÎñ1ÖеȴýÊäÈë1ʱ£¬ÏÔʾ³öselectÆ¥ÅäµÄÐÐ
µ±ÊÂÎñ1ÖÐÊäÈë1ʱ£¬ÏÔʾ½á¹ûÈçÏ£º
ERROR 1205 (HY000): Lock wait timeout exceeded; try restarting transaction
½áÂÛ£ºµ±selectʱ»á¼ì²âµ±Ç°ÊÇ·ñÓÐÊÂÎñ»áÐ޸ģ¨±ÈÓ°ÏìҪȷÇÐһЩ£©µ±Ç°µÄ¼Ç¼ʱ£¬²Å»á±»×èÈû¡£
ÊÔÑé2
ÔÚÊÂÎñ1£º
#!/usr/bin/python
import time
import MySQLdb;
conn = MySQLdb.connect(host="localhost",port=3306,user="root",passwd="asdf",db="test",unix_socket="/data/mysql_3306/mysql.sock")
cursor = conn.cursor()
cursor.execute("select * from test lock in share mode")
while str!="exit":
    str = raw_input()
cursor.close()
conn.close()
ÔÚmysqlÃüÁîÐÐÖÐÊäÈëÒÔÏ£º
mysql> update test set id=id-1;
ERROR 1205 (HY000): Lock wait timeout exceeded; try restarting transaction
½áÂÛ£ºµ±ÊÂÎñÖаüº¬select ...lock in share modeµÄʱºò£¬Ïà¹Ø¼Ç¼½«»á±»Ëøס£¬²»ÔÊÐí½øÐÐÐ޸ġ£
ÊÔÑé3
Ö´ÐÐÏÂÃæµÄpython½Å±¾Á½±é£¬²¢ÇÒͬʱÊäÈë1£¬2Ö®ºó
#!/usr/bin/python
import time
import MySQLdb;
conn = MySQLdb.connect(host="localhost",port=3306,user="root",passwd="asdf",db="test",unix_socket="/data/mysql_3306/mysql.sock")
cursor = conn.cursor()
cursor.execute("select * from test lock in share mode")
str = ""
while str!="1":
    str = raw_input()
while str!="2":
    str = raw_input()
cursor.execute("update test set id=id-1")
while str!="exit":
    str = raw_input()
cursor.close()
conn.close()
[root@TJSJHL196-139 tmp]# python test_transaction.py 
1
2
Traceback (most recent call la


Ïà¹ØÎĵµ£º

MySQL Êý¾ÝÀàÐÍ Ïê½â


ÊýÖµÀàÐÍ
¡¡¡¡MySQL µÄÊýÖµÊý¾ÝÀàÐÍ¿ÉÒÔ´óÖ»®·ÖΪÁ½¸öÀà±ð£¬Ò»¸öÊÇÕûÊý£¬ÁíÒ»¸öÊǸ¡µãÊý»òСÊý¡£Ðí¶à²»Í¬µÄ×ÓÀàÐͶÔÕâЩÀà±ðÖеÄÿһ¸ö¶¼ÊÇ¿ÉÓõģ¬Ã¿¸ö×ÓÀàÐÍÖ§³Ö²»Í¬´óСµÄÊý¾Ý£¬²¢ÇÒ MySQL ÔÊÐíÎÒÃÇÖ¸¶¨ÊýÖµ×Ö¶ÎÖеÄÖµÊÇ·ñÓÐÕý¸ºÖ®·Ö»òÕßÓÃÁãÌî²¹¡£
¡¡¡¡±íÁгöÁ˸÷ÖÖÊýÖµÀàÐÍÒÔ¼°ËüÃǵÄÔÊÐí·¶Î§ºÍÕ¼ÓõÄÄÚ´æ¿Õ¼ä¡£ ......

mysqlÖØа²×°Ê±·þÎñÎÞ·¨Æô¶¯´íÎó½â¾ö°ì·¨

MySQL°²×°Ä¿Â¼ÏµÄDataĿ¼ÖÐ .err´íÎóÐÅÏ¢:
Default storage engine (InnoDB) is not available
½â¾ö°ì·¨:
ɾ³ýÔÚMySQL°²×°Ä¿Â¼ÏµÄDataĿ¼ÖеĠ
ib_logfile0 
ib_logfile1 
ÖØÐÂÆô¶¯MySQLµÄService  ......

mysql explainÖеÄusing filesort

Using filesort±íʾÔÚË÷ÒýÖ®Í⣬ÐèÒª¶îÍâ½øÐÐÍⲿµÄÅÅÐò¶¯×÷¡£µ¼Ö¸ÃÎÊÌâµÄÔ­ÒòÒ»°ãºÍorder byÓÐÕßÖ±½Ó¹Øϵ£¬Ò»°ã¿ÉÒÔͨ¹ýºÏÊʵÄË÷ÒýÀ´¼õÉÙ»òÕß±ÜÃâ¡£
explain SELECT * from table_item WHERE user_id = 2 ORDER BY item_id LIMIT 0, 5
user_id ºÍ item_id ·Ö±ð½¨Á¢Ò»¸öË÷Òý£¬¶Ô´ËÓï¾äMySQLÑ¡ÔñÁË user_idË÷Òý£¬ÄÇô ite ......

ms sqlµ½mysqlµÄÒÆÖ²£º¹ØÓÚÊý¾ÝÀàÐÍÒÆÖ²µÄһЩÎÊÌâ

   ms sqlÖеÄintÐÍĬÈÏÊÇ4룬mysqlµÄintÐÍĬÈÏÊÇ11λ£¬Ç°Õßµ½ºóÕßµÄÒÆÖ²²»»áÓÐʲôÒþ»¼£¬µ«ÊǺóÕßµ½Ç°ÕßµÄÒÆÖ²¾Í´æÔÚλÊý²»¹»£¬²»ÄÜ´æ´¢´óÊýµÄÒþ»¼¡£
   »¹ÓÐbigint£¬ms sqlÊÇ8룬mysqlĬÈÏÊÇ20λ¡£ ......

Oracle,MySQL,MSSQL ServerºÍAccessÊý¾Ý¿âµÄͳ¼Æº¯Êý

Oracle,MySQL,MSSQL ServerºÍAccessÊý¾Ý¿âµÄͳ¼Æº¯Êý
ÎÒÃÇÔÚ±à³ÌÖг£ÓõÄͳ¼Æº¯ÊýÓмÆÊý,ÇóºÍ,Çó×î´óÖµ,Çó×îСֵ,Çóƽ¾ù,·½²îºÍ±ê×¼²î.
·½²î(Variance)
·½²îÊDZê׼ƫ²îµÄƽ·½¡£×éÖеÄÖµ£¬ÓëËüÃÇƽ¾ùÖµÖ®¼äÆ«Àë³Ì¶ÈµÄ¶ÈÁ¿¡£
±ê׼ƫ²î(Standard Deviation)
Ò»¸ö²ÎÊý£¬Ö¸³öÒ»ÖÖ·½Ê½£¬Ò»¸ö¸ÅÂʺ¯ÊýÒÔÕâÖÖ·½Ê½·Ö²¼ÔÚƽ¾ùÖµ¸ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ