1 Answer
1

/var/run should be unwritable for unprivileged users means that root and sudo accounts (as these are privileged users) are allowed to write to it.

The upstart script for MySQL is started as root and then is allowed to create a file or directory in /var/run. And this file is created with the permission as set in the configuration. This should be /etc/my.cnf and it will have something like this:

[mysqld]
user = mysql
socket = /var/lib/mysql/mysql.sock

You should have something related to mysql in /etc/init.d After I installed MySQL Server I get this:

What is "upstart script for MySQL"? Is it mysqld? Unfortunately mysqld cannot create directories under /var/run/ on my system automaticly. I don't know why. Where may I configure mysqld settings?
–
GreenJul 21 '13 at 17:08

- yes mysqld. It is in /etc/init.d - it uses /etc/my.cnf (default that is) for settings and permissions.
–
RinzwindJul 21 '13 at 18:02

For some reason I don't have mysqld in /etc/init.d/. It is in /usr/sbin/mysqld. I followed this post forums.gentoo.org/viewtopic-t-952230-start-0.html and just changed socket and pid-file paths in /etc/my.cnf to different directory. Now all works fine. However I don't know if this is a right way. Nevertheless, thank you for your attention.
–
GreenJul 21 '13 at 19:11

see update @green you must be doing something wrong ;)
–
RinzwindJul 21 '13 at 20:13