I want to connect to a database on my colleague's machine. In the account password everything is correct situation, or encountered a few problems.
1, Firewall
By telnet colleague Machine IP 3306, the result is not even on. have dealt with similar problems. Then you can telnet by shutting down the firewall on your colleague's machine directly.
2, the connection database is very slow
Connecting to the MySQL database in PHP is very slow. I thought there was an exception to the PHP extension. So change CMD to operate, the result connection is still very slow. This makes me rule out the reason for PHP. Baidu, that is because the MySQL connection has the following several steps:
1, DNS resolution of the host of the connection
2, can not resolve, direct current IP connection.
So, by adding a line of code under [Mysqld] in the MySQL configuration file:
Skip-name-resolve to bypass MySQL's DNS resolution when connecting to a remote database
2. When starting the MYSQLD server, attach the –skip-name-resolve option, the same principle as the first
3. Increase the value of host_cache_size, the default value of Host_cache_size is 128 for multiple remote hosts
Because I am using IP to connect, the root DNS resolution is not. So, in the process of parsing, it takes a long time. This period of time causes a DNS resolution timeout. Through the above code, directly let MySQL do not go to DNS resolution.
Note: If you use the –skip-grant-tables system, you will not have access to any user access control, but you can use mysqladmin flush-privileges or mysqladmin reload to open access control; The databases statement is open to all users,
If the MySQL server does not open a remote account, add skip-grant-tables to the My.ini