Slow remote connection to MySQL

Source: Internet
Author: User
Tags reverse dns

Remote connection to MySQL is slow. Sometimes it takes 4-20 seconds to remotely connect to MySQL. The local connection to MySQL is normal. The main cause of this problem is that the reverse DNS resolution is enabled for the MySQL instance installed by default, in my. INI (in Windows) or my. add skip-name-resolve to [mysqld] of the CNF (Unix or Linux) file.

However, this will cause a problem: when connecting to MySQL, you cannot use localhost to connect, but instead use an IP address. If you grant permissions to users by localhost, you must modify the user logon permission.

Later, I found a solution on the Internet, and added it to my. ini.

[Mysqld]
Skip-name-resolve
Skip-grant-tables

This is faster!

Skip-name-resolve

To disable DNS resolution, and the connection speed is much faster. However, in this case, the host name cannot be used in the MySQL authorization table, but only in IP Format.

If you use the-Skip-grant-tables system, no access control is required for any user's access. However, you can use mysqladmin flush-privileges or mysqladmin reload to enable access control; by default, the show databases statement is open to all users,

If the MySQL server does not have a remote account, add skip-grant-tables to my. ini.

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.