0

I have a strange problem that I'm sure is down to the socket. I cannot specify the socket in the mysqld section of the my.cnf config, if I do, the server fails to start.

I have another broader question surrounding this, here MySQL Socket configuration issue in my.cnf but this is is, I feel, the crux of the issue, so I'm asking specifically here for the relationship between the socket specified in the [mysql] section (client) and socket specified in the daemon section [mysqld].

Do they have to match? What could it mean if I cannot specify the socket there?

Thanks.

4
  • Whats the distro? Mar 18, 2014 at 17:28
  • What error to you get when you specify a socket? Are you getting some kind of file not found/directory not writable permissions error, or what?
    – Zoredache
    Mar 18, 2014 at 17:46
  • Matthew, it's Ubuntu 12.10 X64.
    – i-CONICA
    Mar 18, 2014 at 18:32
  • Zoredache, if I add the socket specification as specified in [mysql] to the [mysqld] section, upon restarting MySQL with service mysql restart, it fails to restart saying: Can't connect to local MySQL server through socket {specified socket}.
    – i-CONICA
    Mar 18, 2014 at 18:34

2 Answers 2

0

Yes the sockets settings need to match. A socket is a mode of communication between processes. The server specifies a path, which like a phone number or ip address, which it will listen for requests/communication. The client software connects to the path for the socket. If the client and server have different values, then it would be like dialing the wrong number or visiting the wrong URL.

If you can't start the server when you have specified a socket, then you possibly have an invalid path, or you are pointing to a location where the server cannot write for some reason. Fix that. If you want change it to some other location where where the server does have access, and then update your clients with the new path.

4
  • Hi, That's fantastically helpful, so it is one connecting to the other via that same socket. That goes a long way to explaining my long DB wait times sometimes. Can you please see my other question then, which is more broad than this specific misunderstanding? Thank you.
    – i-CONICA
    Mar 18, 2014 at 18:35
  • Ah, after re-reading your addition, so that socket path can be pretty much anywhere, so long as mysql and mysqld both point to the same thing. Got it. So is there a specific error log I might look in to see if it's a permission issue when specifying the daemon to use that socket?
    – i-CONICA
    Mar 18, 2014 at 18:37
  • Getting somewhere now. There is no mysql.sock file in that directory. The rest of the files are owned by mysql:mysql, if I create the mysql.sock file, I assume mysql is the correct owner? What's the reason that the client section of my.cnf which has that sock file specified isn't erroring in any way, and mysql does actually work, albeit with these occasional huge lags? Thanks.
    – i-CONICA
    Mar 18, 2014 at 18:46
  • 1
    You shouldn't try to manually create the file, the mysql server creates it, when the socket is specified in the configuration. The mysql/percona error log is where I would look. If you don't see any useful messages I might look to enable verbose logging. I might also try restarting the server under strace and watch all system calls related to the socket path.
    – Zoredache
    Mar 18, 2014 at 19:05
0

You should make sure that the directory where the mysql.sock file is, is writable by the MySQL process. It isn't enough that the other files in the directory are owned by mysql:mysql.

2
  • And the directory where mysql.sock file is, is that owned by mysql:mysql? Mar 20, 2014 at 10:06
  • The /run/mysqld directory which contains the mysqld.sock file is owned by mysql:root :S
    – i-CONICA
    Mar 20, 2014 at 12:12

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .