MySQL Connection Error Error 2002 (HY000): Can ' t connect to local MySQL server through socket

Source: Internet
Author: User

After installing MySQL connection error:

[[email protected] app]# Mysqlerror 2002 (HY000): Can ' t connect to local MySQL server through socket '/var/lib/mysql/mysql . Sock ' (2) [[email protected] app]# mysql-uroot-penter Password:error 2002 (HY000): Can ' t connect to local MySQL server Through socket '/var/lib/mysql/mysql.sock ' (2)

Analysis: Error

Can ' t connect to local MySQL server through socket '/var/lib/mysql/mysql.sock '


Query your own Mysql.sock file

Find your own path in

[Email protected] data]# Find/-name Mysql.sock/tmp/mysql.sock

The specified Mysql.sock file is added to the my.cnf.

[Email protected] data]# Vim/etc/my.cnf[mysqld]socket=/tmp/mysql.sock


fack!! Restart MySQL service problem still exists

Then add a soft connection

[[email protected] data]# mkdir -pv /var/lib/mysqlmkdir:  created directory  /var/lib/ MySQL "[[email protected] data]# ln -s /tmp/mysql.sock /var/lib/mysql/mysql.sock[ [email protected] data]# mysqlwelcome to the mysql monitor.   commands end with ; or \g.your mysql connection id is  1server version: 5.6.16 source distributioncopyright  (c)  2000, 2011,  Oracle and/or its affiliates. all rights reserved. oracle is a registered trademark of oracle corporation and/or  Itsaffiliates. other names may be trademarks of their respectiveowners . type  ' help; '  or  ' \h '  for help. Type  ' \c '  to clear the current input  statement.mysql>


Problem Solving!!!


Question: The installation of MySQL has been specified by-dmysql_unix_addr=/tmp/mysql.sock, but why is it not effective?




This article is from the "willing to share with you" blog, please be sure to keep this source http://pengjc.blog.51cto.com/9255463/1861088

MySQL Connection Error Error 2002 (HY000): 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.