Bug #77900 Wrong default location for the socket file
Submitted: 31 Jul 2015 6:48 Modified: 3 Aug 2015 14:34
Reporter: Eugene Maliy Email Updates:
Status: Not a Bug Impact on me:
None 
Category:MySQL Server: Connection Handling Severity:S3 (Non-critical)
Version:5.6.20-68.0 OS:Linux
Assigned to: CPU Architecture:Any

[31 Jul 2015 6:48] Eugene Maliy
Description:
Current behavior: 
The default location for the socket file that the server uses for communication with local clients is /tmp/mysql.sock. 

/var/run ( run-time variable data ) - this directory contains system information data describing the system since it was booted. Files under this directory must be cleared (removed or truncated as appropriate) at the beginning of the boot process. 
Process identifier (PID) files (which were originally placed in /etc) must be placed in /var/run. The naming convention for PID files is <program-name>.pid. 
System programs that maintain transient UNIX-domain sockets (uses the same convention and) must place them in this directory.

Additionally, execution of the "sudo rm -rf /tmp/*" takes place from time to time (theoretically it is a wrong and forbidden action, but in reality it happens due to the different reasons - as a result no possibility for logging into mysql).

Importance: It will be more logical\suitable\convenient location and allow us to avoid additional restart of MySQL service if any actions with temporary directory are performed. 

How to repeat:
sudo rm -rf /tmp/*

Suggested fix:
set default (for server and clients) location into 
/var/run/mysqld/mysql.socket
[3 Aug 2015 14:34] MySQL Verification Team
Hi!

Thank you for your bug report. However this is not a bug.

First and first of all, both options that you are writing about settable at startup. Hence, you can set them at any value of your choice.

Next, there are so many different flavors of Linux, each with its own setup. Furthermore, we do not support only Linux, but so many other operating systems, like Solaris, OS X, BSD etc. We can not force all those users to use the values that are suitable for your flavor of Linux. 

Last, but not least, operating systems defaults change during time. They are not carved in stone.