Ô¶³ÌÁ¬½ÓmysqlËÙ¶ÈÂýµÄ½â¾ö·½·¨
Ô¶³ÌÁ¬½ÓmysqlËÙ¶ÈÂýµÄ½â¾ö·½·¨
http://www.xishuiw.com
¡¡¡¡PHP Ô¶³ÌÁ¬½ÓMYSQLËÙ¶ÈÂý,ÓÐʱԶ³ÌÁ¬½Óµ½MYSQLÓÃʱ4-20Ãë²»µÈ,±¾µØÁ¬½ÓMYSQLÕý³£,³öÏÖÕâÖÖÎÊÌâµÄÖ÷ÒªÔÒòÊÇ,ĬÈϰ²×°µÄMYSQL¿ªÆôÁËDNSµÄ·´Ïò½âÎö,ÔÚMY.INI(WINDOWSϵͳÏÂ)»òMY.CNF(UNIX»òLINUXϵͳÏÂ)ÎļþµÄ[mysqld]ϼÓÈëskip- name-resolveÕâÒ»¾ä¡£Á¬½ÓmysqlËÙ¶ÈÂýµÄ½â¾ö·½·¨.
¡¡¡¡2̨·þÎñÆ÷£¬Ò»Ì¨ÅÜiis+php£¬Ò»Ì¨ÅÜmysql£¬ºÍÒÔÍùÒ»ÑùÅäÖúû·¾³£¬²âÊÔÒ³ÃæÒ»ÇÐOK
¡¡¡¡ÅÜÓ¦ÓõÄʱºò·¢ÏÖphp·ÃÎÊmysqlËٶȺÜÂý£¬ÕâÖÖÇé¿öÔÚÒÔǰ´Óδ·¢ÏÖ¹ý£¬ËäÈ»2̨·þÎñÆ÷²¢·ÇÔÚÍ¬Ò»Íø¶ÎÖУ¬µ«ÊÇpingÊýÖµ»ù±¾É϶¼ÔÚ1,2ms Ö®¼ä£¬tcpÁ¬½ÓÓ¦¸Ã²»ÊÇÎÊÌâ¹Ø½¡£¬googleÒÔºóÕÒµ½´ð°¸£¬ÔÚmy.iniÎļþµÄ[mysqld]²¿·Ö¼ÓÈë:skip-name-resolve£¬±£´æÎļþ£¬ÖØÆômysql£¬Ò»ÇÐOKÀ²£¬ËÙ¶ÈÏó·ÉÒ»ÑùÁË
¡¡¡¡Ð°汾µÄmysqlÅäÖÃÆðÀ´²»ÏóÒÔǰµÄÄǸöɵ¹Ï»¯ÁË£¬Õâ¸öÎÊÌâÕÛÌÚÁËÎÒÒ»ÉÏÎçµÄʱ¼ä£¬ÍíÉÏ»ØÀ´×ÜËãÊǽâ¾öÁË£¬ºÙºÙ£¬ÓÖѧµ½Ò»Ð©¶«Î÷¡£
¡¡¡¡Windows 2003ϵÄMySQL 5·þÎñÆ÷£¬±¾»úÁ¬½Óµ½MySQL·þÎñ·Ç³£¿ì£¬¾ÖÓòÍøÄÚÓÐÁ½Ì¨Linux»úÆ÷£¬ÓÐһ̨Á¬½ÓºÜ¿ì£¬ÁíÍâһ̨ÊäÈëÃÜÂëºóÒªµÈºÃ¼¸ÃëÖÓ²ÅÄÜÁ¬ÉÏ¡£
½â¾ö°ì·¨£º
ÔÚMySQL·þÎñÆ÷µÄÅäÖÃÖÐÔö¼ÓÒ»¸öÈçÏÂÅäÖúóËٶȷɿ졣
[mysqld]
skip-name-resolve
¸½Â¼£º( How MySQL uses DNS )
When a new thread connects to mysqld, mysqld will spawn a new thread to handle the request. This thread will first check if the hostname is in the hostname cache. If not the thread will call gethostbyaddr_r() and gethostbyname_r() to resolve the hostname.
If the operating system doesn't support the above thread-safe calls, the thread will lock a mutex and call gethostbyaddr() and gethostbyname() instead. Note that in this case no other thread can resolve other hostnames that is not in the hostname cache until the first thread is ready.
You can disable DNS host lookup by starting mysqld with --skip-name-resolve. In this case you can however only use IP names in the MySQL privilege tables.
If you have a very slow DNS and many hosts, you can get more performance by either disabling DNS lookop with --skip-name-resolve or by increasing the HOST_CACHE_SIZE define (default: 128) and recompile mysqld.
You can disable the h
Ïà¹ØÎĵµ£º
ÔÎÄÁ´½Ó http://database.51cto.com/art/200904/117957.htm
ÒÔÏÂÊÇÉæ¼°µ½²åÈë±í¸ñµÄ²éѯµÄ5ÖָĽø·½·¨£º
1)ʹÓÃLOAD DATA INFILE´ÓÎı¾ÏÂÔØÊý¾ÝÕ⽫±ÈʹÓòåÈëÓï¾ä¿ì20±¶¡£
2)ʹÓôøÓжà¸öVALUESÁбíµÄINSERTÓï¾äÒ»´Î²åÈ뼸ÐÐÕ⽫±ÈʹÓÃÒ»¸öµ¥ÐвåÈëÓï¾ä¿ì¼¸±¶¡£µ÷Õûbulk_insert_buffer_size±äÁ¿Ò²ÄÜÌá¸ß£¨Ïò°üº¬Ðеıí ......
°²×°·þÎñÆ÷¶Ë£ºÏÂÔØÒ»¸ömysqlµÄ°²×°³ÌÐò£¬ÎÒ°²×°µÄÊÇ5.0°æ±¾µÄ£¬°´ÕÕÌáʾһ²½²½²Ù×÷Íê³É¡£Ã»ÓÐÊ²Ã´ÌØ±ð˵Ã÷µÄ¡£
°²×°¿Í»§¶Ë£ºÏÂÔØÒ»¸ömysql-query-browser£¬ÎÒÓõÄÊÇ1.1°æ±¾µÄ£¬°²×°£¬°´ÕÕÌáʾ²Ù×÷¡£
¶¼°²×°Íê³ÉÒÔºó£¬ÔÚ±¾»úÓÃbrowser²âÊÔÒ»ÏÂÊÇ·ñÄÜÁ¬µÄÉϱ¾»úµÄ·þÎñ£¬Á¬½Ó³É¹¦£¬¶¼°²×°OK.
Èç¹ûÄãÏëÈÃÆäËûµÄ¿ª·¢ÈËÔ±Ò»Æð ......
ÊÔÑé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 = r ......
1.mysqlÊÇÒ»¸ö·Ç³£·½±ãµÄ¹ÜÀímysql·þÎñÆ÷µÄ¿Í»§¶ËÈí¼þ¡£ ´´½¨Ò»¸ömysql·þÎñÆ÷µÄÁ¬½ÓµÄʱºòÓ¦¸Ã×¢ÒâÌîдÐÅÏ¢µÄʱºòÏÈÔÚ×¢²áÀ¸ÌîдµÇ½Óû§ÃûºÍÃÜÂ룬ÔÙÔÚÁ¬½ÓÀ¸Ìîд·þÎñÆ÷Ãû£¬¶Ë¿ÚºÅ¡£
2.ʹÓÃmysql-frontµÄʱºò£¬½¨Á¢Ò»¸öµÇ½ÊôÐÔÒÔºó£¬ÔÙÔÚÃüÁîÐвÙ×÷mysqlÊý¾Ý¿â£¬mysql-frontµÄÊý¾ÝÐèÒªÊÖ¶¯Í¬²½²Å¿ÉÒÔ¿´µ½Ê¹ÓÃÃüÁîÐжÔÊý¾ ......
²âÊÔ»·¾³£ºUbuntu 9.10 + MySQL 5.1.37-1ubuntu5
Ubuntu ÔÚÆô¶¯¹ÜÀí init.d
ÀïÃæ¹ØÓÚ MySQL µÄÃüÁîÓУº
/etc/init.d/mysql start|stop|restart|reload|force-reload|status
ÀýÈçÖØÆôMySQL·þÎñ£ºsudo /etc/init.d/mysql restart
......