Startup MySQL encounters a problem can ' t connect to local MySQL server through socket '/tmp/mysql.sock ' (2)

Source: Internet
Author: User
Tags mysql host unix domain socket

The following errors are sometimes encountered during the startup process of MySQL

Can ' t connect to local MySQL server through socket '/tmp/mysql.sock ' (2)


may I ask mysql.sock what the role of this file? How do I avoid such errors?
answer one, This mysql.sock should be MySQL host and client on the same host (physical server), use UNIX domain socket as the carrier of the communication protocol, it is faster than TCP. The common cause of this problem is that your MySQL server is not running. look at your/tmp/mysql.sock. Does this file exist? Under normal circumstances it should be there, or use netstat to see if there are any in the results
Active UNIX domain sockets

answer two, This file is the file used for the socket connection.
that is, only your daemon is up and the file exists.
However, your MySQL program (this program is the client, server side mysqld) can choose whether to use the Mysql.sock file to connect (because this method is only suitable for the UNIX host to connect the local mysqld), for non-local any type of host. These manuals in MySQL (including the Chinese version of Yanzi translations, covering 3.23/4.0 versions) are described. Just look and you can understand.

The previous friend said cannot connect, the most likely is mysqld this daemon process did not start.

answer three,

There are two ways to connect MySQL:

(1) TCP/IP (2) socketfor Mysql.sock, the MySQL client program MySQL is on the same machine as the MySQL server-side program MySQLServer, which is available when initiating a local connection . For example, you do not need to define a specific IP to connect to the host, as long as it is empty or localhost. In this case, even if you change the external port of MySQL It is also possible to connect normally. Because After you change the port in My.ini or MY.CNF, theMysql.sock is generated with every MySQL server startup. The information has been changed since you restarted MySQL when you finished changing the my.cnf. Then for an external connection, you must change the port to connect. The above content is from: http://blog.csdn.net/kerwin612/article/details/8568206 for the above problems, in fact, sometimes equivalent to When you start mysqld, it takes a long time to display the Timeout error occurred trying to start MySQL Daemon.This error! See previous blog content: http://www.cnblogs.com/adair/p/7775155.html

Startup MySQL encounters a problem can ' t connect to local MySQL server through socket '/tmp/mysql.sock ' (2)

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.