Bug #56574 After installation from RPM, server is run under root, not mysql user
Submitted: 5 Sep 2010 23:13 Modified: 3 Oct 2010 1:35
Reporter: Elena Stepanova Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Packaging Severity:S3 (Non-critical)
Version:5.5.5-m3, 5.5.6-m3, 5.6.0-m4 OS:Linux (SLES 10.2)
Assigned to: CPU Architecture:Any
Triage: Needs Triage: D2 (Serious)

[5 Sep 2010 23:13] Elena Stepanova
Description:
After RPM installation or upgrade (performed by root), mysqld_safe starts server with empty --user value, and the process is run under root rather than mysql user, as it used to be before, and still said in the manual (http://dev.mysql.com/doc/refman/5.5/en/linux-rpm.html).

How to repeat:
- install MySQL server from rpm
- run /etc/init.d/mysql start
- check process list to see that mysqld process is run under root, and has empty --user option

or

- run RPM upgrade while MySQL server is already running
- check process list 

Suggested fix:
It looks like 'user' variable in mysqld_safe is not populated anymore:
user=''
 In mysqld_safe.sh, it looks like
user='@MYSQLD_USER@'

Apparently, MYSQLD_USER is not defined when it is supposed to.

If it was an intentional change, documentation needs to be updated. Otherwise, the variable should be set.
[5 Sep 2010 23:16] Elena Stepanova
5.1.50 and 5.5.3-m3 work okay.
[7 Sep 2010 15:06] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/117712

3091 Joerg Bruehe	2010-09-07
      Fix bug#56574:
      After installation from RPM, server is run under root, not mysql user
      
      The problem was that in the cmake way of building
      the variable "MYSQLD_USER" was not set and propagated.
      In the script "mysqld_safe" its value is used as the
      name of the user who should run the server process.
      
      The fix is to explicitly set this variable to "mysql"
      and propagate it in the build process.
      It was analyzed and proposed by Jonathan Perkin.
[7 Sep 2010 15:32] Joerg Bruehe
The problem is related to cmake builds, so it affects only versions 5.5 and up.

The patch was approved in IRC and mail.

The patch is now part of the sources used to build 5.5.6-rc.
[9 Sep 2010 13:49] MC Brown
A note has been added to the 5.5.6 changelog: 

        After an RPM installation <command>mysqld</command> would be                                                                     
        started with the <literal>root</literal>, rather than                                                                            
        the <literal>mysql</literal> user.
[10 Sep 2010 18:51] Bugs System
Pushed into mysql-5.5 5.5.7-rc (revid:joerg@mysql.com-20100910184813-csdto6tk4nlogrsq) (version source revid:joerg@mysql.com-20100910184813-csdto6tk4nlogrsq) (merge vers: 5.5.7-rc) (pib:21)
[13 Sep 2010 13:49] Bugs System
Pushed into mysql-trunk 5.6.1-m4 (revid:dlenev@mysql.com-20100913103627-p2oqplu42x1gv2bd) (version source revid:dlenev@mysql.com-20100913102657-ye9uwx05td7h2q3o) (merge vers: 5.6.1-m4) (pib:21)
[13 Sep 2010 13:51] Bugs System
Pushed into mysql-next-mr (revid:dlenev@mysql.com-20100913121556-sfxqlpj9kbc28kaf) (version source revid:dlenev@mysql.com-20100913121556-sfxqlpj9kbc28kaf) (pib:21)
[23 Sep 2010 22:25] Paul Dubois
Noted in 5.6.1 changelog.