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