MySQL connection error: Can ' t get hostname for your address

Source: Internet
Author: User

Simple explanation

MySQL Server received a request from-you-to-connect to the database. So next thing it tried to do are to check the name is bound to your IP address (name resolution) and it failed to do s O. So it just denied you access.

You can understand how MySQL handles client-side parsing:
1, when MySQL client initiates a connection request, MySQL Server proactively checks the host name of the client.
2, first find the Windows system directory under the/etc/hosts file, search domain name and IP correspondence.
3, if the Hosts file does not, look for DNS settings, if not set up the DNS server, will immediately return to failure, if the DNS server is set, reverse parsing until timeout.

Solutions The first method modifies the hosts

On the server where MYSQL server is located, modify the Windows Hosts file to add a row of records, such as:

172.28.208.149 www.xxxx.com

But this method is very mechanical, so the following method is generally used.

the second way to modify the MySQL configuration file My.ini

The solution:
Just add skip-name-resolve option to your MySQL configuration file (My.ini).

In the MYSQL Server configuration file My.ini, add the following two lines:

[Mysqld]

Skip-name-resolve

It will prevent MySQL Server from DNS parsing of external connections, and using this option can eliminate the time for DNS resolution for MySQL.

The third way to modify MySQL startup service

 Enter the system service by running "Services.msc", locate the MySQL service, then open the login, select the Local System account instead of this account by selecting login status:------------------------------------------------------------------------------- My problem is this cause!

MySQL connection error: Can ' t get hostname for your address

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.