Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

AgentSmith

macrumors newbie
Original poster
Jul 16, 2008
5
0
Australia
Hi

I want to start up mysql automatically and have created a plist file to do so, and placed it in the LaunchDaemons directory....but... i start mysql with "mysqld_safe --user=root" and don't know the correct way of passing the --user=root parameter to mysqld_safe.

eg part of the plist file:

<key>Label</key>
<string>com.mysql.mysqld</string>
<key>Program</key>
<string>/var/root/mysql/bin/mysqld_safe</string>
<key>ProgramArguments</key>
<array>
<string>--user=root</string>
</array>

doesn't seem to work. neither does

<key>Program</key>
<string>/var/root/mysql/bin/mysqld_safe --user=root</string>

Help appreciated :)
 

AgentSmith

macrumors newbie
Original poster
Jul 16, 2008
5
0
Australia
Thanks for the link. My google search didn't turn up anything particularly useful.

Worked out that I needed to do this:

<key>Label</key>
<string>com.mysql.mysqld</string>
<key>Program</key>
<string>/var/root/mysql/bin/mysqld_safe</string>
<key>OnDemand</key>
<false/>
<key>ProgramArguments</key>
<array>
<string>/var/root/mysql/bin/mysqld_safe</string>
<string>--user=root</string>
</array>


instead of:

<key>Label</key>
<string>com.mysql.mysqld</string>
<key>Program</key>
<string>/var/root/mysql/bin/mysqld_safe</string>
<key>OnDemand</key>
<false/>
<key>ProgramArguments</key>
<array>
<string>--user=root</string>
</array>
</dict>


I was assuming that setting the Program string would launch the program and program arguments would be the parameters, which isn't the case. Seems that the First argument needs to be the program and the following arguments are the parameters.

Thanks again. Now mysql starts automatically when I reboot my iphone :D
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.