Bug #80980 mysql-community-server-5.7.11-1.el6.x86_64.rpm, mysqld service will not start
Submitted: 6 Apr 2016 15:44 Modified: 15 Apr 2016 7:39
Reporter: Shane Furlong Email Updates:
Status: Not a Bug Impact on me:
None 
Category:MySQL Server: Installing Severity:S3 (Non-critical)
Version:5.7.11 OS:CentOS
Assigned to: CPU Architecture:Any

[6 Apr 2016 15:44] Shane Furlong
Description:
Attempts to start the mysqld service fail.  The default location for my .pid file is /var/run/mysqld/mysqld.pid, the owner is linux user mysql with permissions on the file of 640, permissions on the directory /var/run/mysqld is 755 and it is owned by linux user mysql as well. When I attempt to start the server, it keeps trying to start but eventually gives up and fails. Nothing in the log is of any use. 
If I go into my /etc/my.cnf file and hardcode this: 
[mysqld_safe] 
pid-file=/var/lib/mysql/mysqld.pid (putting the pid file in my data directory) 

and then I attempt to start the service, it works. It also creates a "bonus" pid file (mysqld_safe.pid). The datadir is owned by mysql of course with permissions of 751. The 2 files that are created when I start the server have these attributes 
mysqld.pid (owned by mysql with 640 permissions) 
mysqd_safe.pid (owned by root with 660 permissions). 
While this change has me up and running, I am still confused as to why the out of the box RPM location did not work. Having said that, this is a new version, 5.7.11 for Red Hat el6 64 bit RPM. It could be a version specific bug.

How to repeat:
Well, I am a bit closer to knowing why my attempts to start the mysqld service failed. The default location for my .pid file is /var/run/mysqld/mysqld.pid, the owner is linux user mysql with permissions on the file of 640, permissions on the directory /var/run/mysqld is 755 and it is owned by linux user mysql as well. When I attempt to start the server, it keeps trying to start but eventually gives up and fails. Nothing in the log is of any use. 
If I go into my /etc/my.cnf file and hardcode this: 
[mysqld_safe] 
pid-file=/var/lib/mysql/mysqld.pid (putting the pid file in my data directory) 

and then I attempt to start the service, it works. It also creates a "bonus" pid file (mysqld_safe.pid). The datadir is owned by mysql of course with permissions of 751. The 2 files that are created when I start the server have these attributes 
mysqld.pid (owned by mysql with 640 permissions) 
mysqd_safe.pid (owned by root with 660 permissions). 
While this change has me up and running, I am still confused as to why the out of the box RPM location did not work. Having said that, this is a new version, 5.7.11 for Red Hat el6 64 bit RPM. It could be a version specific bug.

Suggested fix:
Workaround is to hardcode the .pid location to the data directory.

If I go into my /etc/my.cnf file and hardcode this: 
[mysqld_safe] 
pid-file=/var/lib/mysql/mysqld.pid (putting the pid file in my data directory) 

and then I attempt to start the service, it works. It also creates a "bonus" pid file (mysqld_safe.pid). The datadir is owned by mysql of course with permissions of 751. The 2 files that are created when I start the server have these attributes 
mysqld.pid (owned by mysql with 640 permissions) 
mysqd_safe.pid (owned by root with 660 permissions).
[6 Apr 2016 18:14] Shane Furlong
I was able to fix this problem by adding an extra argument to my data directory initialization process.  By adding --pid-file=/var/run/mysqld/mysqld.pid I was able to "bake that location into the installation."  This fixed the problem for me, but I never had to include that argument in any previous data directory initializations. My full command was:
/usr/bin/mysqld --initialize --datadir=/var/lib/mysql --pid-file=/var/run/mysqld/mysqld.pid --basedir=/usr --plugin-dir=/usr/lib64/mysql/plugin --explicit_defaults_for_timestamp=1
[6 Apr 2016 20:28] Terje Røsten
Hi!

Thanks for your report.

When running 

/usr/bin/mysqld --initialize ..

any setting in a [mysqld_safe] section in default config file 
is ignored. 

[mysqld_safe] section is only used when running under mysqld_safe.

However, mysqld_safe and mysqld will of course using any [mysqld] section
present in config file, so fix might be simple, convert

[mysqld_safe]
foo=bar

to
[mysqld]
foo=bar

Does that improve things for you?
[6 Apr 2016 20:32] Shane Furlong
Your comment is helpful.  I will try your suggestion on my next installation.
[9 Apr 2016 0:26] MySQL Verification Team
Then the issue was resolved ?. Thanks.
[11 Apr 2016 13:08] Shane Furlong
I tried the latest suggestion but it did not fix the problem.  I did however, install the software on a similar CentOS 6.7 system where it is working fine.  I can only think there is something different between the 2 systems.  At present, I have moved forward with my project on the 2nd system.  When I finish the current project, I will explore the 2 systems for differences.
[15 Apr 2016 7:39] MySQL Verification Team
Per note [11 Apr 13:08] Shane Furlong,  this seems to be system specific issue.

If you can provide more information, feel free to add it to this bug and change the status back to 'Open'.

Thank you for your interest in MySQL.