Bug #41067 pid file not created at start
Submitted: 27 Nov 2008 9:53 Modified: 17 Apr 2014 18:23
Reporter: Christophe Baegert Email Updates:
Status: No Feedback Impact on me:
None 
Category:MySQL Server: General Severity:S3 (Non-critical)
Version:5.0.32-Debian_7etch6-log OS:Linux (Debian etch i386)
Assigned to: CPU Architecture:Any

[27 Nov 2008 9:53] Christophe Baegert
Description:
The pid-file of mysqld is not created, so mysqld can't be monitored by our usual monitoring software, although it is configured to do it.

The my.cnf contains "pid-file = /var/run/mysqld/mysqld.pid"

The "ps afux|grep mysqld" command shows "mysql    30658  2.2  4.2 443300 88340 ttyp0    Sl   10:17   0:42  \_ /usr/sbin/mysqld --basedir=/usr --datadir=/var/lib/mysql --user=mysql --pid-file=/var/run/mysqld/mysqld.pid --skip-external-locking --port=3306 --socket=/var/run/mysqld/mysqld.sock"

And the "show variables" in MySQL shows "| pid_file                        | /var/run/mysqld/mysqld.pid  |"

The permissions of /var/run/mysqld are OK :
0 drwxr-xr-x 2 mysql mysql 41 2008-11-27 10:17 /var/run/mysqld

mysql.sock is created in the same directory without problem

I tried to launch safe_mysqld with strace, grep shows no occurences of "pid" in the trace file...

How to repeat:
I have no idea why this problem occurs. It occurs always on this computer, other computers with the same distribution, the same mysql package and the same configuration files (I verified /etc/mysql/* with diff) don't have this problem.
[27 Nov 2008 9:55] Christophe Baegert
I just restarted it once more and now I can see the pid file.... random bug ?
[27 Nov 2008 10:49] Sveta Smirnova
Thank you for the report.

> I just restarted it once more and now I can see the pid file.... random bug ?

We can not say, because we can not repeat it. This also can be, because somebody removed this file after mysqld has started.

Additionally you use old version of MySQL. Please try current version 5.0.67 and if problem still exists try to find pattern when pid file is not created.
[28 Dec 2008 0:00] Bugs System
No feedback was provided for this bug for over a month, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
[17 Mar 2014 15:12] Michael Steele
I'm still seeing this problem. As documented in http://askubuntu.com/questions/284679/why-doesnt-mysql-create-the-pid, I tried touch /var/run/mysqld/mysqld.pid; chown mysql: mysql /var/run/mysqld/mysqld.pid, restart mysql, but the file was erased and not recreated. I stopped mysql, touch/chown again, start mysql. The file wasn't erased, but it was still empty.

$ mysql --version
mysql  Ver 14.14 Distrib 5.1.67, for debian-linux-gnu (x86_64) using readline 6.2
$ lsb_release -a
No LSB modules are available.
Distributor ID:	Ubuntu
Description:	Ubuntu 11.10
Release:	11.10
Codename:	oneiric
[17 Mar 2014 18:23] Sveta Smirnova
Michael,

thank you for the feedback. But version 5.1 is not supported anymore. Please try with one of current versions: 5.5 or 5.6 and, if problem still exists, send us output of SHOW VARIABLES LIKE 'pid_file';
[18 Apr 2014 1:00] Bugs System
No feedback was provided for this bug for over a month, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
[13 Apr 2018 22:14] Sheryl Canter
I am having this problem right now with the latest version of MySQL, just downloaded. I have tried everything under the sun for two days to get it to work, and cannot. There are dozens more reports of problems all over the internet. For details of my problem with version numbers and log files, please see this post:

https://apple.stackexchange.com/questions/322463/can-start-mysql-server-quit-w-o-updating-...

Please fix this!!
[13 Apr 2018 23:59] Sheryl Canter
My problem turned out to be a version incompatibility. I needed to user 5.7.16 for OSX El Capitan. Can't say why so many other people have the same problem, though.