If MySQL cannot be started,/var/run/mysqld. Sock cannot be connected.

Source: Internet
Author: User

In the past two days, I want to start two different versions of MySQL on my computer at the same time. However, if the two versions of MySQL fail to be started, one of them may fail to start and become depressed. I cannot start it in either of the following ways:

I. The problem is as follows:

1, [root @ blackghost data] #/usr/local/MySQL/bin/mysqld_safe -- user = root -- skip-grant-tables

The prompt is as follows:

100910 22:31:44 mysqld_safe logging to '/usr/local/MySQL/master-error.log '.
100910 22:31:44 mysqld_safe starting mysqld daemon with databases from/usr/local/MySQL/Data
100910 22:31:44 mysqld_safe mysqld from PID file/usr/local/MySQL. PID ended

2. [root @ blackghost MySQL] #/usr/local/MySQL/share/MySQL. Server start

The prompt contains the following:

Starting mysql. Manager of PID-file quit without updating file. [failed]

Later, I found out that the reason for this was that I overwrote mysqld under the/MySQL installation directory/libexec. I thought mysqld in MySQL was similar, I did not expect that the mysqld under libexec is different, and the difference is big.

  1. [Root @ blackghost bin] # Du-SH mysqld
  2. 12 K mysqld
  3. [Root @ blackghost bin] # Du-Sh ../libexec/mysqld
  4. 6.1 m ../libexec/mysqld

Another file under libexec is mysqlmanager. I want to use mysqld here as a management object. I'm not sure what mysqld under libexec is, can anyone tell me? Thank you.

The mysqld of 12 K is a startup, stop, and other control script, which can be opened with VI, but the mysqld under libexec cannot be opened with VI and garbled characters are opened.

Ii. Solution

1. Because I have two different versions of MySQL, so I will test the mysqld under another libexec. I don't think there will be any problems.

2. After I tested mysqld under libexec, I still couldn't start it, and I still asked the error in question 1. I found a lot of ways on the Internet and there was a way to solve it, is to delete the/MySQL installation directory/data/mysql-bin.index, and then in

/Usr/local/MySQL/bin/mysqld_safe -- user = root -- skip-grant-tables

Then it starts.

3. prompt me when I use MySQL-u root-P

Error 2002 (hy000): Can't connect to local MySQL server through socket '/var/run/mysqld. Sock' (2)

However, the. Sock file in my. CNF is defined in/tmp/MySQL. Sock. How can I get there?

There are two ways to solve this problem

A), add a soft link, Ln-S/var/run/mysqld/MySQL. Sock/tmp/MySQL. Sock

B), MySQL-u root-p-S/tmp/MySQL. Sock

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.