Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

On Mac, MySQL seems to save data as the "_mysql" user. Can somebody please explain how this is achieved. I would have expected the MySQL server application (mysqld) to have the setuid flag set, so that it would run as _mysql, but this isn't the case. How, then, does it somehow run as "_mysql"?

share|improve this question

1 Answer 1

up vote 0 down vote accepted

There's a wide variety of ways this can be accomplished, but the two most common are:

  1. Processes started as root can change their user id to any other user on the system through their own internal programming; most daemons including MySQL operate this way.
  2. Processes can be started with sudo -u _mysql mysqld or it's rough equivalent.
share|improve this answer
    
Thanks Chris. In relation to (1), would this be through system-specific APIs? I'm wondering how you go about this in C or Java. –  visitor93746 Aug 25 '10 at 20:53
1  
setuid() and friends in C –  James Aug 25 '10 at 22:28
    
Directions for calling setuid() from Java: www2.sys-con.com/itsg/virtualcd/Java/archives/0510/Silverman/… –  Chris S Aug 25 '10 at 22:33

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.