PHP environment locally with IP connection MySQL response fast, with localhost connection slow resolution

Source: Internet
Author: User

For a long time, the local PHP environment, with localhost connection MySQL, as long as the access to query the database page, there will be slow response to the phenomenon, find some information has not been resolved.

Today, a sudden use of IP connection, hair down speed unexpectedly much faster, friends came to help see the next.

Check the Hosts file, found 127.0.0.1 did not parse to localhost, suddenly dawned ah.

Did not parse the past, the response speed of course slow, it each time to find their own.

The second is to modify the Mysql.default_host in the php.ini configuration file and write the first argument in mysql_connect () as an empty string; This method has not been tested successfully, it may be that I have neglected some places ~ ~


remote connection MySQL slow


The main reason for this problem is that MySQL, which is installed by default, turns on DNS reverse resolution, adding skip-name-resolve to [mysqld] of files under My.ini (Windows System) or MY.CNF (Unix or Linux systems) Save.

Start-"Run"-"cmd--" net stop mysql-"net start mysql--" Haha, successful

My.ini path such as: D:\Program files\mysql\mysql Server 5.0\my.ini

The original is the problem of MySQL, so the operation can not be used in the MySQL authorization table in the host name and can only use IP.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.