Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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
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
setuid() and friends in C – James Aug 25 '10 at 22:28
Directions for calling setuid() from Java:… – Chris S Aug 25 '10 at 22:33

Your Answer


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.