MySQL Can ' t connect to MySQL Server processing method

Source: Internet
Author: User
Tags ip number mysql client mysql tutorial numeric value

Can ' t connect to [local] MySQL tutorial server
b.5.2.2.1. Connect to the MySQL tutorial server in Windows otherwise
The UNIX MySQL client can connect to two different ways to start the MYSQLD server: by using a UNIX socket file, via the file system (default is/tmp directory/mysql.sock File connection), or by using the TCP/IP protocol, the connection passes through a port number. A UNIX socket file connection is faster than the TCP/IP protocol, but can only be used when connecting to a server on the same computer. One is to use a UNIX socket file if you do not specify a host name 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 the Named pipe option to start, you can also name the pipe 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 connect a host name to Mysqld, a MySQL client first attempts to connect to the named pipe. If it does not work, it is connected to the TCP/IP port. You can use the named pipe used by force on Windows. As the host name.

Error (2002) cannot connect to ... Usually means that there is no MySQL server running on the system, or you are using an incorrect UNIX socket filename or TCP/IP port number to try to connect to the server. You should also check the TCP/IP ports you are using and are not blocked by firewall or port interception services.

Error (2003) The server that cannot connect to the MySQL server ' (10061) indicates that the network connection has been denied. You should check to see if a MySQL server is running, it has network connectivity, and the network port you specify is configured on the server.

First check to see if a process named Mysqld is running on your server host. (Use PS Tutorial Homes | grep starts mysqld by pressing Task Manager on UNIX or Windows. If there is no such process, you should start the server. See 2.13.1.3, "Startup and troubleshooting MySQL server."

If a mysqld process is running, you can try it by checking the following command. The port number or UNIX socket file name may be different when you set it up. The server on which the HOST_IP represents the computer is running an 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, as possible:

1, the MySQL service does not start, generally in the case of the exception of MySQL can not start, such as no available disk space, My.ini mysql basedir path set error, etc.

2, the MySQL server resource is tight, causes cannot connect.

Workaround:

1, if you are a virtual host user (buy space), then contact space to check whether MySQL normal startup, and confirm MySQL configuration information (whether for localhost);

2, if you are a stand-alone host user (with administrative host permissions), then follow the steps below to check:

1 Check whether 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 it is in a started state.

Linux host, perform service at console MySQL start start MySQL service.

2 Check disk space for remaining free space and try to keep enough disk space available.

3 Check the My.ini basedir (MySQL installation address) and DataDir (data directory storage address) and other parameters set is correct, and then restart the MySQL service.

4 If the occasional normal display after refreshing and the server is a Windows system, then reduce windows TcpTimedWaitDelay time to resolve such problems, By default 240 (also this value is not set) This setting needs to be set up in the following registry location Hkey_local_ Machinesystemcurrentcontrolsetservicestcpipparameterstcptimedwaitdelay If this item is not tcptimedwaitdelay in the registry, please add this item, and set to a double byte (DWORD) type numeric value set to 30 ~ 60 can be

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.