mysql Can''t connect to MySQL server processing methods

Source: Internet
Author: User
Keywords Network programming Mysql tutorial
Tags check client connect connecting default different disk disk space

can not connect to [local] mysql tutorial server
b.5.2.2.1. Connect to mysql tutorial server in windows otherwise unix mysql client can connect to two different ways to start mysqld server: by using unix socket file, by connecting to the file system (default is / tmp / mysql.sock file connection ), Or by using the tcp / ip protocol, connect through a port number. A unix socket file is faster than the tcp / ip protocol but can only be used when connecting to a server on the same machine. One is to use a unix socket file if you do not specify a hostname or if you specify a special hostname localhost.

If the mysql server is running on windows, you can connect through the tcp / ip protocol. If the server is using - Enable Named Pipes option to start, you can also name the plumbing connection if the server running on your host runs the client. The name of the named pipe is the default mysql. If you do not give a host name to connect to mysqld, a mysql client first tries to connect to the named pipe. If it does not work, it connects to the tcp / ip port. You can use it on windows by using force named pipes. As the host name.

Error (2002) Unable to connect to ... Normally means that no mysql server is running on the system, or you are trying to connect to the server when you are using an incorrect unix socket file name or tcp / ip port number. You should also check the tcp / ip port that you are using and are not blocked by the firewall or port interception service.

Error (2003) Unable to connect server to mysql server '(10061) Indicates that the network connection has been denied. You should check if there is a mysql server running, it has network connectivity, and the network port you specified is one configured on the server.

First check if there is a process named mysqld running on your server host. (Use ps Tutorials | grep Press start on mysqld on unix or windows task manager. If yes) There is no such process and you should start the server. See 2.13.1.3, "Starting and Troubleshooting a MySQL Server."

If a mysqld process is running, you can try to check the following command it. The port number or unix socket file name may be different for you. The host computer on which host_ip is running is the ip number.

shell> mysqladmin version
shell> mysqladmin variables
shell> mysqladmin -h `hostname` version variables
shell> mysqladmin -h `hostname` --port = 3306 version
shell> mysqladmin -h host_ip version
shell> mysqladmin --protocol = socket --socket = / tmp / mysql.sock version

problem analysis:

Unable to connect to the mysql server, possible situation:

1, mysql service does not start, usually in the case of abnormal mysql can not start caused, such as no available disk space, my.ini mysql basedir path setting error;

2, mysql server resources, resulting in unable to connect.

Solution:

1, if you are a virtual host user (the purchase of space), then contact the space to check whether the normal start mysql, and confirm mysql configuration information (whether localhost);

2, if you are an independent host user (with management console permissions), according to the following steps to check:

1) Check whether the mysql service is started.

Windows host, right-click My Computer, click Management, find the mysql service in the service and application to see if it is started state.

Linux host, the implementation of the service console mysql start mysql service.

2) Check the disk space is still free space, try to keep enough disk space available.

3) Check my.ini basedir (mysql installation address) and datadir (data directory storage address) and other parameters set correctly, and then restart the mysql service.

4) If the occasionally refresh normal occasionally and the server is a windows system, then reducing windows tcptimedwaitdelay time to solve this problem, the default is 240 (not set the case is the value) This setting needs to The registry settings as follows hkey_local_machinesystemcurrentcontrolsetservicestcpipparameterstcptimedwaitdelay If tcptimedwaitdelay this project is not in the registry, increase this project, and set the double-byte (dword) type value is set to between 30 ~ 60

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.