Not the answer you need?
Register and ask your own question!

default socket file wrong socket file name

sanjay92sanjay92 ContributorCurrent User Role Beginner
>> mysql -usystem -pMypassword
Somehow, it is using wrong socket file when using mysql client to connnect

ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/home/mysql/mysql01.sock'

in /etc/my.cnf
I have following
[mysqld]
socket=/home/mysql/mysql.sock

[client]

[mysql]
socket=/home/mysql/mysql.sock


But still mysql client says Socket '/home/mysql/mysql01.sock' while it should be Socket '/home/mysql/mysql.sock'

I also checked that I don't have .my.cnf in my default home dir.
What am I missing ?

Comments

  • scott.nemesscott.nemes MySQL Sage Current User Role Patron
    Hi sanjay92;

    Are you able to connect when you specifying the socket explicitly (--socket=/home/mysql/mysql.sock)?

    And what user are you using to connect? root? If so check /root/.my.cnf

    -Scott
  • sanjay92sanjay92 Contributor Current User Role Beginner
    Yes, I was able to connect using socket syntax.
    I have found issue.
    There was my.cnf in /opt/mysql/5.1.7 and that's what causing issue since socket was wrong in this file.

    mysqladmin -usystem -pPassword

    Shows me following output which gave me clue about issue.
    Default options are read from the following files in the given order:
    /etc/my.cnf /etc/mysql/my.cnf /usr/local/mysql/etc/my.cnf /opt/mysql/5.1.7/my.cnf ~/.my.cnf

    Thanks a lot.
Sign In or Register to comment.

MySQL, InnoDB, MariaDB and MongoDB are trademarks of their respective owners.
Copyright ©2005 - 2020 Percona LLC. All rights reserved.