Mysql Can't connect to MySQL server

Source: Internet
Author: User
Tags ip number mysql tutorial

 

Can't connect to [local] mysql tutorial server
B .5.2.2.1. Connect to the mysql tutorial server on windows. Otherwise
On the unix mysql client, you can connect to two different methods to start the mysqld server: by using a unix socket file, you can use the/tmp directory/mysql in the file system. or use the tcp/IP protocol to connect to a port number. A unix socket file is faster than the tcp/IP protocol, but can only be used when connected to a server on the same computer. One is a unix socket file, if you do not specify a host name or if you specify a special host name localhost.

If the mysql server runs on windows, you can connect to the mysql server through the tcp/IP protocol. If the server uses the-enable 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 pipeline is the default mysql. If you do not connect a host name 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 a named pipe using force on windows. As the host name.

Error (2002) cannot connect... it usually means that there is no mysql server running on the system, or you are using an incorrect unix socket file name or TCP/IP Port Number to connect to the server. You should also check that the TCP/IP Port you are using is not blocked by the firewall or port interception service.

Error (2003) indicates that the network connection has been rejected because the server cannot connect to mysql Server '(10061. You should check whether a mysql server is running. It has the network connection function and the network port you specify is configured on the server.

First, check whether a process named mysqld runs on your server host. (Use ps | grep to start mysqld in the Job Manager on unix or windows. If so, you should start the server. See section 2.13.1.3 "Start and troubleshoot mysql servers ".

If a mysqld process is running, you can try to check the following command. The port number or unix socket file name may be set differently. Host_ip indicates that the server of 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, possible situation:

1. the mysql service is not started. It is generally caused by the failure of mysql to start in case of exceptions, such as no available disk space or incorrect basedir path setting of mysql in my. ini;

2. the mysql server cannot be connected due to insufficient resources.

Solution:

1. If you are a VM user (purchased space), contact the Space Provider to check whether mysql is started normally and confirm the mysql configuration information (whether it is localhost );

2. If you are an independent host user (with host management permissions), perform the following steps:

1) check whether the mysql service is started.

For a windows host, right-click my computer, click manage, and find the mysql service in the services and applications to check whether it is in the enabled status.

 

On a linux host, run service mysql start on the console to start the mysql service.

2) check whether there is any available space in the disk space and try to keep enough disk space available.

3) check whether the parameter settings of basedir (mysql installation address) and datadir (data directory storage address) in my. ini are correct, and then restart the mysql service.

4) if the server is occasionally displayed normally after refresh and the server is a windows system, reducing the tcptimedwaitdelay time in windows can solve this problem, the default value is 240 (this value is also not set). You need to set hkey_local_machinesystemcurrentcontrolsetservicestcpipparameterstcptimedwaitdelay in the Registry as follows. Add this project if no tcptimedwaitdelay exists, and set it to the double byte (dword) type value to 30 ~ Between 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.