Solution to connect MySQL hint can ' t connect to local MySQL server through socket

Source: Internet
Author: User
Tags mysql client parse error

Yesterday at home using Ubuntu installed a MySQL, pretty good outfit. After the installation is complete. To start the MySQL client remote access. I just put the my.cnf in the config file to allow only native machine access is: 127.0.0.1 commented out to him. As shown:

Then restart Mysql:sudo service MySQL restart boot ok

Then I restarted the computer again. The error 2002 (HY000): Can ' t connect to local MySQL server through socket '/var/lib/mysql/mysql.sock ' (2) is displayed when you go to start MySQL.

Workaround:

First, check to see if the port exists. See if there's 3306.

Check that the MySQL configuration file is correct cat my.cnf

Page Tip/var/lib/mysql/mysql.sock indicates that the Mysql.sock is generated after startup

Where's the Mysql.sock file? Find/-name ' *.socket '

Parse error log

Cd.. /var/log/mysql

# tail-f Error.log

Add/var/log/mysql and all subordinate subdirectories with permissions:

Also add chmod 777 plus permissions to the current user: See error log plus permissions directory ...

Reboot restart your computer

sudo service MySQL restart restart MySQL success

Solution to connect MySQL hint can ' t connect to local MySQL server through socket

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.