Bug #70814 /etc/init.d/mysql does not recognize pid-file under [mysqld_safe] in my.cnf
Submitted: 4 Nov 2013 22:10 Modified: 9 Feb 2015 17:23
Reporter: Pura Vida Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Documentation Severity:S3 (Non-critical)
Version:5.7.1-m11 OS:Linux
Assigned to: Paul DuBois CPU Architecture:Any

[4 Nov 2013 22:10] Pura Vida
Description:
The following is excerpted from /etc/init.d/mysql:

{code}
parse_server_arguments `$print_defaults $extra_args mysqld server mysql_server mysql.server`

#
# Set pid file if not given
#
if test -z "$mysqld_pid_file_path"
then
  mysqld_pid_file_path=$datadir/`hostname`.pid
else
{code}

parse_server_arguments does not get parameter from [mysqld_safe]
section, and therefore pid-file specified there is ignored, and
the code will assign a value which is `hostname`.pid. This value
is then passed to /usr/bin/mysqld_safe.

However, according to the version 5.7 documentation, pid-file is
a parameter of mysqld_safe. 

The fix is either add mysqld_safe to the list of 
parse_server_arguments (not tested but should work), or
move pid-file to [mysqld] section (tested and worked).

How to repeat:
see description.

Suggested fix:
see description.
[14 Nov 2013 19:10] Sveta Smirnova
Thank you for the report.

I see at http://dev.mysql.com/doc/refman/5.7/en/mysql-server.html:

----<q>----
 mysql.server reads options from the [mysql.server] and [mysqld] sections of option files. For backward compatibility, it also reads [mysql_server] sections, although you should rename such sections to [mysql.server] when using MySQL 5.7.

mysql.server supports the following options. 
...
--pid-file=file_name

The path name of the file in which the server should write its process ID. 
----</q>----

So I see no mention of the mysqld_safe. Please send us a link which tells that mysql.server startup script should read from section [mysqld_safe]
[15 Dec 2013 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".
[15 Dec 2013 2:08] Pura Vida
Here is the link:

http://dev.mysql.com/doc/refman/5.7/en/mysqld-safe.html

It states that

mysqld_safe supports the following options. It also reads option files and supports the options for processing them described at Section 4.2.3.4, “Command-Line Options that Affect Option-File Handling”.

and pid-file is listed in the table.
[19 Dec 2013 17:26] Sveta Smirnova
Thank you for the feedback.

You mix two scripts: mysql.server (which can call mysqld_safe) and mysqld_safe itself (which can run as stand-alone program). But you are correct that docs are a bit confusing for cases when mysql.server calls mysqld_safe since it passes pid_file as a paramater to mysqld_safe and which has precedence on the same option, but specified under mysqld_safe section.

Verified as documentation bug.
[19 Dec 2013 20:19] Pura Vida
I would like to comment on what you said
"mysql.server calls mysqld_safe since it passes pid_file as a paramater to mysqld_safe and which has precedence on the same option, but specified under mysqld_safe section".

The pid-file parameter that mysql.server passed to to mysqld_safe is not
a "real" parameter, but a parameter that it "made up" (assumed, or default)
by mysql.server. It would not make sense that a made-up parameter to have 
higher precedence over a real, specified parameter in mysqld_safe section,
which the document says where it belongs.

And also remember, there is no such a "problem" 5.5, so this new behavior
is not backward compatible.

Just to clarify. Thank you for taking care of this.
[9 Feb 2015 17:23] Paul DuBois
Thank you for your bug report. This issue has been addressed in the documentation. The updated documentation will appear on our website shortly.

Will add this to the mysql.server --pid-file description:

If this option is not given, mysql.server uses a default value of
host_name.pid. The PID file value passed to mysqld_safe overrides any
value specified in the [mysqld_safe] option file group. Because
mysql.server reads the [mysqld] option file group but not the
[mysqld_safe] group, you can ensure that mysqld_safe gets the same
value when invoke using mysql.server as when invoked manually by
putting the same pid-file setting in both the [mysqld_safe] and
[mysqld] groups.