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 hostname cache with --skip-host-cache. You can clear the hostname cache with FLUSH HOSTS or mysqladmin flush-hosts.
If you don't want to allow connections over TCP/IP, you can do this by starting mysqld with --skip-networking.
PHPÔ¶³ÌÁ¬½ÓMYSQLËÙ¶ÈÂý,ÓÐʱԶ³ÌÁ¬½Óµ½MYSQLÓÃʱ4-20Ãë²»µÈ,±¾µØÁ¬½ÓMYSQLÕý³£,³öÏÖÕâÖÖÎÊÌâµÄÖ÷ÒªÔÒòÊÇ,ĬÈÏ°²×°µÄMYSQL¿ªÆôÁËDNSµÄ·´Ïò½âÎö,ÔÚMY.INI(WINDOWSϵͳÏÂ)»òMY.CNF(UNIX»òLINUXϵͳÏÂ)ÎļþµÄ[mysqld]ϼÓÈëskip-name-resolveÕâÒ»¾ä¡£
MYSQLÔ¶³ÌÁ¬½ÓËÙ¶ÈÂýµÄ½â¾ö·½·¨
ÔÚ¾ÖÓòÍøÄÚÁ¬½ÓÆäËû»úÆ÷µÄMYSQL,·¢ÏÖËÙ¶ÈÂýµÄºÜ,²»ÖªµÀʲôÔÒò,×ÜÓм¸ÃëµÄÑÓ³Ù.
ºóÀ´ÔÚÍøÉÏ·¢ÏÖ½â¾ö·½·¨,my.iniÀïÃæÌí¼Ó
[mysqld]
skip-name-resolve
skip-grant-tables
ÕâÑùËٶȾͿìÁË!
skip-name-resolve
Ñ¡Ïî¾ÍÄܽûÓÃDNS½âÎö£¬Á¬½ÓËٶȻá¿ìºÜ¶à¡£²»¹ý£¬ÕâÑùµÄ»°¾Í²»ÄÜÔÚMySQLµÄÊÚȨ±íÖÐʹÓÃÖ÷»úÃûÁ˶øÖ»ÄÜÓÃip¸ñʽ¡£
ÈôʹÓÃ-skip-grant-tablesϵͳ½«¶ÔÈκÎÓû§µÄ·ÃÎʲ»×öÈκηÃÎÊ¿ØÖÆ£¬µ«¿ÉÒÔÓà mysqladmin flush-privileges»òmysqladmin reloadÀ´¿ªÆô·ÃÎÊ¿ØÖÆ;ĬÈÏÇé¿öÊÇshow databasesÓï¾ä¶ÔËùÓÐÓû§¿ª·Å£¬
Èç¹ûmysql·þÎñÆ÷ûÓпªÔ¶³ÌÕÊ»§£¬¾ÍÔÚmy.iniÀïÃæ¼ÓÉÏskip-grant-tables
¶¯¸ÐϺÈÊ ÓÚ 2010-05-13 04:50:15·¢±í:
Ò»±ÕÑÛÒ»ÕöÑ۾Ϳ´¼ûÂ¥Ö÷µÄÌû×ÓÁË£¬Ôµ·ÖÄÄ£¡
ÊÍÈ»µÄ°®¾«Áé ÓÚ 2010-05-13 01:56:47·¢±í:
ºÜºÃºÜÇ¿´ó£¬»Øȥɢ²¥ÏûϢȥ¡£
СËá÷¹û ÓÚ 2010-05-12 19:44:27·¢±í:
Ïë¹à¾Í¹à£¬¹àË®¿ìÀÖ£¬¹à×í²»ÊÇ´í
Ö»°®±¦±´µÄè ÓÚ 2010-05-12 16:19:55·¢±í:
ÒªÈËÉù¶¦·Ð£¬Ò»¡°¶¥¡±¾ªÈË
ssvee ÓÚ 2010-05-12 03:18:39·¢±í:
Ì«Å£BÀ ʵÔÚ̫ллÀ²
jianglg2008 ÓÚ 2009-09-22 12:38:18·¢±í:
ºÜºÃ£¬¸Ðл¥Ö÷·ÖÏí
fengyqf ÓÚ 2009-09-16 14:44:29·¢±í:
ºÜºÃ£¬¸Ðл¥Ö÷·ÖÏí
amwssess ÓÚ 2008-02-16 17:06:46·¢±í:
ÊÔһϣ¬Ð»Ð»Â¥Ö÷£¡£¡£¡£¡£¡£¡