When connecting to the MySQL database server, sometimes the client will report 2003 error code, and prompt: Unable to connect to the server, but the server can ping, the possible reasons are as follows:
1. The network does not pass.
Check to be able to ping through.
2. Firewall settings.
Whether the firewall has spared the MySQL process, whether to block the MySQL Port 3306.
Account settings for 3.mysql.
Whether the MySQL account does not allow remote connections. If you cannot connect, you can try the following methods:
Mysql-u root-p // login mysql mysql'root' %'with GRANT OPTION; // any remote host can access the database mysql> FLUSH privileges; // you need to enter a secondary command to make the changes effective mysql> EXIT //
You can also implement a remote by modifying the table:
Mysql-u root-p mysql> Use mysql; MySQLset'%'where'root'; MySQLSelect from
4. mysql database does not start
This is also the case I encountered, to the Windows service options to see that there is no MySQL database service This option, remember the beginning of the installation of MySQL is there. So in this case I reinstall the MySQL database, the Windows service has this option, restart the MySQL database, you can connect and use the MySQL database properly.
5.MySQL server resource is strained, resulting in inability to connect
Workaround:
(1), if you are a virtual host user (purchase space), then contact the space provider to check whether MySQL startup, and confirm the MySQL configuration information (whether localhost);
(2), if you are a standalone host user (with administrative host permissions), follow these steps to check:
1) Check if the MySQL service is started.
Windows host, right click on My Computer, click Manage, find the MySQL service in the service and application to see if the status is started.
If "Error 2003:can ' t connect to MySQL server on ' localhost ' (10061)" appears, your MySQL has not started yet.
Workaround:
The first step
Remove the My.ini below c:windowns
Step Two
Open C:mysqlbinwinmysqladmin.exe Enter user name and password
Step three Enter Mysqld-nt-remove Delete service under DOS
In the next input Mysqld-nt-install
Fourth step input MySQL boot success
In fact, the cause of the error is more than just a few aspects, I believe that the above ideas to find out why, will be able to solve the problem. You can also refer to the problem set here: http://database.51cto.com/mysql/
About MySQL 2003 client connection error handling method