Ô¶³ÌÁ¬½Ó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
Ïà¹ØÎĵµ£º
ÖØ×°Ê±³öÏÖcould not start the service mysql error:0µÄ´íÎóʱ
ÔÚ¿ØÖÆÃæ°åÖÐÔËÐÐÌí¼Óɾ³ý³ÌÐò£¬½«mysqlÐ¶ÔØ;
Ð¶ÔØºó´ò¿ª×¢²á±í£¬²é¿´HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services ϵļüÖµ£¬Èç¹ûÓÐÏà¹Ømysql¼üÖµ(mysql¡¢mysqladmin)Ôòɾµô£¬¼´¿É;
ÖØÆô£¬½«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 = r ......
mysqlÔÚsdkÖÐΪcÓïÑÔÌṩÁËһЩ·ÃÎʽӿڣ¬ÎÒÃÇ¿ÉÒÔʹÓÃÕâЩ½Ó¿ÚÁ¬½Ó²¢·ÃÎÊmysqlÊý¾Ý¿â£¬µ±È»Ò²¿ÉÒÔµ÷ÓÃmysqlµÄ´æ´¢¹ý³Ì¡£
Àý×Ó£º
Ê×ÏÈÏÂÔØmysqlµÄsdk£¬½âѹºÃÒÔºó£¬ÀïÃæ°üº¬Ò»¸öinclude,ºÍlibÎļþ¼Ð¡£ÎÒÃÇÔÚ×Ô¼ºµÄ¹¤³ÌÖаüº¬ÕâÁ½¸öÎļþ¼ÐµÄĿ¼£¬²¢Ç ......
Ò»¡¢Á¬½ÓMYSQL
¸ñʽ£º mysql -hÖ÷»úµØÖ· -uÓû§Ãû -pÓû§ÃÜÂë
1¡¢ÈôÊÇÁ¬½Óµ½±¾»úÉϵÄMYSQL£ºÊ×ÏÈ´ò¿ªDOS´°¿Ú£¬È»ºó½øÈëĿ¼mysql\bin£¬»òÕß½«mysql\bin°²×°Â·¾¶ÉèÖÃÔÚ»·¾³±äÁ¿pathÖУ¬ÔÙ¼üÈëÃüÁîmysql -u root -p£¬»Ø³µºóÌáʾÄãÊäÃÜÂë.×¢ÒâÓû§Ãûǰ¿ÉÒÔÓпոñÒ²¿ÉÒÔûÓпոñ£¬µ«ÊÇÃÜÂëǰ± ......
ÔÚmysqlµÄslow query logÖУ¬¿ÉÄÜ´æÔÚÀàËÆÕâÑùµÄÌØÊâ¼Ç¼£º
# Time: 100127 23:17:01
# User@Host: root[root] @ [127.0.0.1]
# Query_time: 18446744073709.351562 Lock_time: 0.000129 Rows_sent: 1 Rows_examined: 11030
SET timestamp=1264663021;
SELECT dummy.id AS dummy_id
from dummy&nbs ......