A server uses php to connect to the database, but the database address uses an external ip address. it takes 2 s to occasionally obtain the database connection handle.

Source: Internet
Author: User
Tags mysql login
A server uses php to connect to the database, but the database address uses an external ip address, resulting in occasional access to the database connection handle requires 2 seconds. the Last Post is from u011822059 to 2013-09-0311: 29: 58 Editing example: on the server, php connects to the mysql database on the server. on the server where the database is located, php connects to the database, but the database address uses an external ip address, it may take 2 s to occasionally obtain the database connection handle.
This post was last edited by u011822059 at 11:29:58, as shown in the following figure:

On the server, php connects to the mysql database on the server, but the database address uses an external ip address, which may take 2 s to occasionally obtain the mysql database connection handle,

That is to say, the database address connected to mysql uses an Internet ip address (for example, 22.34.1.12 ),

If it is changed to 127.0.0.1, it will not be new. it takes two seconds to obtain the connection handle,

This 2 S occurs occasionally. I want to know the reason. what is the specific point? Thank you, php? Mysql? Connection handle? Internet ip address php 2 s connection handle mysql shared:
------ Solution --------------------
If there is only one ip address, you can directly access
If two or more ip addresses exist
------ Solution --------------------
Server-> firewall-> isp-> firewall-> mysql, and then reverse, it is hard to say how many circles the isp circle around.
------ Solution --------------------
Reference:
2 s is really within the acceptable range. MYSQL has a parameter that sets the domain name not to be resolved to enable this.

Mysql users are actually composed of the host name and user name. Therefore, the host name of the client is determined during mysql login,
In this process, the mysql server needs to reverse resolve the client's IP address to determine the client's host name.
You can modify the skip-name-resolve parameter to set it.

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.