tags:

views:

22

answers:

1

Hello. I'm trying to get MySQL to run under launchd so I set up a launchd item including a "UserName" key with "mysql" as value. I did this because when I start mysql I usually go: mysqld_safe --user=mysql.

When I load it, I get:

10/22/10 11:13:02 AM    com.apple.launchd[1]    (com.mysql.mysqld463) Suspicious setup: User "mysql" maps to user: _mysql
10/22/10 11:13:02 AM    com.apple.launchd[1]    (com.mysql.mysqld) Throttling respawn: Will start in 10 seconds

And MySQL never gets to run. Should I use "_mysql" as the user? I wonder about user mappings because I installed my databases following instructions included in MySQL distribution: using the mysql user to install databases and to run the daemon.

Thank you in advance.

A: 

Just have launchd run exactly the command you would normally run. The one change would be to use an absolute path to mysqld_safe. mysqld_safe will then spawn a mysql process running as the user mysql, and you'll be back in familiar territory.

Jeremy W. Sherman
Thanks! I did it and MySQL starts but now I get this: 10/22/10 2:03:58 PM com.apple.launchd[1] (0x301430.anonymous.nohup[1428]) Bug: launchd_core_logic.c:8297 (24108):0 10/22/10 2:03:58 PM com.apple.launchd[1] (0x301430.anonymous.nohup[1428]) Switching sessions is not allowed in the system Mach bootstrap. 10/22/10 2:03:58 PM com.apple.launchd[1] (0x301430.anonymous.nohup[1428]) _vprocmgr_switch_to_session(): kr = 0x44c. MySQL seems to run ok but when I unload it I get 10/22/10 2:03:19 PM com.apple.launchd[1] (com.mysql.mysqld[1078]) Exit timeout elapsed (20 seconds). Killing
expora
Well, then you could go back to trying to run `mysql` directly using `User = "_mysql"`. You could also try running `mysqld_safe` as that user to see if it avoids the session switch.
Jeremy W. Sherman
It doesn't work either :( I'm trying with both the UserName key and the --user argument. So far the best combination has been UserName root and --user=mysql as program argument but it gives me the switch error. At least I get MySQL running.
expora