Mysql cannot connect to common faults and cause analysis, mysql Cause Analysis
========================================================== ========================================================== ==================================
Fault description: Unable to connect to mysql
ERROR message: ERROR 2003 (HY000): Can't connect to MySQL server on 'hostxxxxx' (10061)
Cause: mysqld Database Service is not started.
Check: in the windows Task Manager or in unix/linux, check out ps-aux | grep mysql. Confirm that the service has been started.
Processing: Start the mysqld service
========================================================== ========================================================== ==================================
========================================================== ========================================
Fault description: Unable to connect to mysql
ERROR message: ERROR 1130: Host xx. xx is not allowed to connect to this MySQL server
Cause: the mysql server does not grant the remote connection permission to the client.
Check: On the mysql server, check whether the host corresponding to the user table in the mysql database contains the IP address of the client machine (% no restriction on IP addresses allow remote connection ).
Processing: Modify the user table in the mysql database: update user set host = '%' where user = 'xxx'; flush privileges;
========================================================== ========================================================== ====
Your user does not use the root account, or your root account does not grant logon permissions, you need to use
Grant all privileges on *. * TO 'myuser' @ '%' identified by 'mypassword' with grant option;
Authorization
========================================================== ========================================================== ==================================
Fault description: Unable to connect to mysql
ERROR message: ERROR 2003 (HY000): Can't connect to MySQL server on 'hostxxxxx' (10061)
Cause: the mysqld client and server port are inconsistent.
Check: the service port is set in my. ini. In this case, especially when the customer is inconsistent with the remote server port, it is easy to see problems.
Processing: Start the mysqld service
========================================================== ========================================================== ==================================
Fault description: Unable to connect to mysql
========================================================== ========================================================== ===
ERROR message: ERROR 2003 (HY000): Can't connect to MySQL server on 'hostxxxxx' (10061)
Cause: mysqld Database Service is not started.
Check: in the windows Task Manager or in unix/linux, check out ps-aux | grep mysql. Confirm that the service has been started.
Processing: Start the mysqld service
========================================================== ========================================================== ===
ERROR message: ERROR 1130: Host xx. xx is not allowed to connect to this MySQL server
Cause: the mysql server does not grant the remote connection permission to the client.
Check: On the mysql server, check whether the host corresponding to the user table in the mysql database contains the IP address of the client machine (% no restriction on IP addresses allow remote connection ).
Processing: Modify the user table in the mysql database: update user set host = '%' where user = 'xxx'; flush privileges;
========================================================== ========================================================== ===
ERROR message: ERROR 1045 (28000): Access denied for user 'usera '@ 'localhost' (using password: YES)
Cause: the user account is not created.
Check: After logging on as administrator ROOT, show grants for 'usera '@ 'localhost'; or select user from mysql. user; to check whether the user account exists.
Process: create a user account.
========================================================== ========================================================== ===
ERROR message: ERROR 2003 (HY000): Can't connect to MySQL server on 'hostxxxxx' (10061)
Cause: the mysqld client and server port are inconsistent.
Check: the service port is set in my. ini. In this case, especially when the customer is inconsistent with the remote server port, it is easy to see problems.
Processing: Start the mysqld service
========================================================== ========================================================== ===
ERROR message: ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql. sock' (111)
Cause: mysql. sock of mysqld is not in the corresponding position.
Processing:
1. First check/etc/rc. d/init. d/mysql status to see if it is enabled.
2. Change the permission chown-R mysql: msyql/var/lib/mysql
3. Modify/etc/my. cnf (Note: Stop the database first)
[mysqld] datadir=/usr/local/mysql/data socket=/var/lib/mysql/mysql.sock [mysql.server] user=mysql basedir=/usr/local/mysql [client] socker=/var/lib/mysql/mysql.sock
4. Start the database
========================================================== ========================================================== ===
========================================================== ========================================================== ===
Common check steps.
1. PING hostname or PING 189. xx to confirm that the server IP layer communication is correct. If PING general rules continue (2), PING general rules seek help from network experts.
2. TELNET hostname 3306 to confirm that the TCP layer communication on the server is correct. (Your port number may not be 3306). If the general rule persists, check whether mysqld is running and the firewall shields the port.
3. check user permissions, show grants...