Unable to connect to MySQL

Source: Internet
Author: User
Tags server port

=====================================================================================================
Symptom: Unable to connect to MySQL
Err Message: Error 1045 (28000): Access denied for user ' usera ' @ ' localhost ' (using Password:yes)
Cause: User account not created
Check: After login with Administrator root, show grants for ' UserA ' @ ' localhost '; Or select User from Mysql.user; Verify that the user account is present.
Process: Create user account.
=====================================================================================================

==========================================================================
Symptom  :  Unable to connect   mysql 
Error message  :error 1130: host xx.xx.xx.xx is not allowed to  CONNECT TO THIS MYSQL SERVER&NBSP
Cause the  : mysql server does not have permission to grant this client remote connection.  
Check  : In the MySQL server local query MySQL library, the user table corresponding to the host contains the client machine IP (% is not limited IP allow remote connection).  
processing  : Modify user table under MySQL library:update user set host =  '% '   where  user = ' XXX ';flush privileges;
====================================================================================

=====================================================================================================
Symptom  :  unable to connect  mysql 
Error message  :ERROR 2003  (HY000):  can ' t connect to  MySQL server on  ' hostxxxxx '   (10061)
Reason  : MYSQLD database service did not start.
Check  : In windows  Task Manager, or under  unix/linux   ps -aux | grep mysql   Check it out. Confirm that the service is started.
Handling  : Starting mysqld  service
============================================================================= ========================

===================================================================================================== 
Symptom  :  Unable to connect  mysql 
Error message  :ERROR 2003  (HY000):  can ' T connect  to MySQL server on  ' hostxxxxx '   (10061)  
Cause  : mysqld  The client is inconsistent with the service-side port.  
Check  : Service port under my.ini  settings   This situation, especially if the client is inconsistent with the remote server port   is prone to problems
processing  : Starting the mysqld  service  
=====================================================================================================  

===================================================================================================== 
Symptom  :  Unable to connect  mysql windows
Error message  :ERROR 2003  (HY000):  can ' t  connect to mysql server on  ' hostxxxxx '   (10061)  
Cause  :   While opening a large number of TCP ports and only a small fraction of the ephemeral ports, when they are in the time_wait period, MySQL may run the wrong port
Check  : 5,000 temporary port confession calls are turned on by default on windows , And their life is only 120s, meaning that when the port is closed there will be 120 seconds delay
Processing  : Reduce unnecessary TCP ports.
Modify the Registry
================================================================================================== === 

=====================================================================================================
Symptom: Unable to connect to MySQL
Err Message: Error 2002 (HY000): Can ' t connect to local MySQL server server through socket '/var/lib/mysql/mysql.sock ' (111)
Reason: Mysqld's mysql.sock is not in the corresponding position.
Processing: 1. Check the/etc/rc.d/init.d/mysql status to see if it starts
2. Change Permissions Chown-r Mysql:msyql/var/lib/mysql
3. Modify/ETC/MY.CNF (Note: first stop database)
[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
=====================================================================================================

Summarized as follows:

Symptom: Unable to connect to MySQL
===================================================================================
Err Message: Error 2003 (HY000): Can ' t connect to MySQL server on ' hostxxxxx ' (10061)
Cause: The MYSQLD database service did not start.
Check: Task Manager in Windows, or unix/linux under Ps-aux | grep MySQL to look at. Confirm that the service is started.
Processing: Starting the MYSQLD service
===================================================================================
Err Message: Error 1130:host xx.xx.xx.xx is not allowed to connect to this MySQL server
Cause: The MySQL server does not have permission to grant this client remote connection.
Check: in MySQL server local query the MySQL library in the user table corresponding to the host contains the client machine IP (% is not limited to allow remote connections IP).
Processing: Modify the user table under MySQL library: Update user set host = '% ' where user = ' XXX '; flush privileges;
===================================================================================
Err Message: Error 1045 (28000): Access denied for user ' usera ' @ ' localhost ' (using Password:yes)
Cause: User account not created
Check: After login with Administrator root, show grants for ' UserA ' @ ' localhost '; Or select User from Mysql.user; Verify that the user account is present.
Process: Create user account.
===================================================================================
Err Message: Error 2003 (HY000): Can ' t connect to MySQL server on ' hostxxxxx ' (10061)
Cause: The MYSQLD client is inconsistent with the service-side port.
Check: Service port under My.ini settings This situation, especially if the client is inconsistent with the remote server port, is prone to problems
Processing: Starting the MYSQLD service
===================================================================================
Err Message: Error 2002 (HY000): Can ' t connect to local MySQL server server through socket '/var/lib/mysql/mysql.sock ' (111)
Reason: Mysqld's mysql.sock is not in the corresponding position.
Processing: 1. Check the/etc/rc.d/init.d/mysql status to see if it starts
2. Change Permissions Chown-r Mysql:msyql/var/lib/mysql
3. Modify/ETC/MY.CNF (Note: first stop database)
[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.xx.xx confirm that there is no problem with the server IP layer communication. If the ping general continues (2), Ping does not seek expert assistance in networking.
2. TELNET hostname 3306 confirms that there is no problem with the server TCP layer communication. (Your port number may not be 3306), as the general rule continues, if not, please check if MYSQLD is already running and the firewall is blocking the port.
3. Check user permissions, show grants ...

Your user is not using the root account, or your root account has not been granted login rights, you need to use
GRANT all privileges on * * to ' myuser ' @ ' percent ' identified by ' MyPassword ' with GRANT OPTION;
Authorized

Unable to connect to MySQL

Related Article

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.