Solution for mysql. sock not found in Linux

Source: Internet
Author: User
The following message is displayed: Gotanerror: Connectionerror: Canrsquo; tconnecttolocalMySQLserverthroughsocketlsquo; varlib

The following message is displayed: Got an error: Connection error: Canrsquo; t connect to local MySQL server through socket lsquo;/var/lib/

The following information is displayed:

Got an error: Connection error: Can't connect to local MySQL server through socket '/var/lib/mysql. sock'

The sudden disappearance of mysql. sock is a common problem. If MySQL is installed for the first time, you only need to find out where mysql. sock is.

The preceding error message, mysql. sock, should be in/var/lib/mysql/. If not, click:

# Find/-name mysql. sock

Find out where to put it, and then try again:

# Mysqladmin-S/find the path/mysql. sock-u root {parameter}

That... What should I do if I suddenly disappear or cannot be found?

You have to restart mysql. the tarball installation can be restarted through mysqld or mysqladmin, And the rpm installation can be performed through service mysql restart. However, when mysql. sock does not exist, it may be impossible to restart mysql. If it does not work, you have to first:

# Ps-aux | grep mysql

Then we cut down the pid.

# Kill the pid

Are you sure you have killed all of them?

# Ps-aux | grep mysql

Make sure that none of mysql is in it, and then execute mysqld or service mysql start.

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.