0

I have changed the location of the socket file in my.cnf, however, when I try to login to mysql, I get the error "Can't connect to local MySQL server through socket 'prev/sock'" (I am using Prev/sock to denote that it is still looking for the previous location/default location).

I have added this parameter in my.cnf file

socket=/opt/data/sockpid/mysql.sock

I am using [mysqld] in my.cnf, not [client]

when I try using the command:

mysql -u root -p -S /opt/data/sockpid/mysql.sock - this bit is working

The parameter is not being read or not working correctly...

1 Answer 1

0

If you change the location of the socket file in the [mysqld] section, you must also change it in the [client] section, or else clients will default to the original location.

As you said, you can specify a socket path when using the client, and that takes precedence over the configuration file or the default.

2
  • I don't have a client section...
    – dbafix
    Jun 23, 2023 at 6:22
  • Use a text editor and add one. Jun 23, 2023 at 6:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.