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.