Bug #80185 mysqld_safe.pid file in datadir after starting with mysqd_safe
Submitted: 28 Jan 2016 13:09 Modified: 2 Feb 2016 12:56
Reporter: Shahriyar Rzayev Email Updates:
Status: Not a Bug Impact on me:
None 
Category:MySQL Server Severity:S2 (Serious)
Version:5.7.10 OS:CentOS (7)
Assigned to: CPU Architecture:Any

[28 Jan 2016 13:09] Shahriyar Rzayev
Description:
As per documentation:

https://dev.mysql.com/doc/mysql-startstop-excerpt/5.7/en/mysqld-safe.html#option_mysqld_sa...

In MySQL 5.7.2 and later, mysqld_safe creates a PID file named mysqld_safe.pid in the MySQL data directory when starting up (Bug #16776528). 
So it should be already fixed in 5.7.2 version

Cloned from Github repo:

cmake -DCMAKE_INSTALL_PREFIX=/opt/mysql-5.7 -DMYSQL_DATADIR=/opt/mysql-5.7/datadir -DSYSCONFDIR=/opt/ -DWITH_SSL=system -DMYSQL_TCP_PORT=3308 -DMYSQL_UNIX_ADDR=/opt/mysql-5.7/mysqld.sock -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci -DWITH_DEBUG=1 -DCOMPILATION_COMMENT="Shahriyar Rzayev's MySQL Server" -DOPTIMIZER_TRACE=1 -DWITH_ZLIB=system -DWITH_VALGRIND=1 -DCMAKE_C_FLAGS=-DHAVE_purify -DCMAKE_CXX_FLAGS=-DHAVE_purify -DWITH_BOOST=/opt/boost

make
make install

Started as:

[root@mysql-57 mysql-5.7]# bin/mysqld_safe --defaults-file=./my.cnf
160128 07:59:15 mysqld_safe Logging to '/opt/mysql-5.7/datadir/error.err'.
160128 07:59:15 mysqld_safe Starting mysqld daemon with databases from /opt/mysql-5.7/datadi

my.cnf file:

sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES
log-error=/opt/mysql-5.7/datadir/error.err 
datadir=/opt/mysql-5.7/datadir
basedir=/opt/mysql-5.7
plugin-dir=/opt/mysql-5.7/lib/mysql/plugin
user=mysql
pid-file=/opt/mysql-5.7/datadir/mysqld.pid 
socket=/opt/mysql-5.7/datadir/mysqld.sock 
port=3308

Version:
[root@mysql-57 mysql-5.7]# bin/mysql --version
bin/mysql  Ver 14.14 Distrib 5.7.10, for Linux (x86_64) using  EditLine wrapper

Result:

[root@mysql-57 datadir]# ls | grep mysqld_safe
mysqld_safe.pid

How to repeat:
See description

Suggested fix:
Maybe it is a regression or misdocumented/open issue
[2 Feb 2016 12:56] Shahriyar Rzayev
As it is an expected behaviour.