Launch mySQL at system startup

Apr 11, '01 05:09:57PM

Contributed by: Gwyrrdin

The following tutorial explains how to get mySQL (via safe_mysqld) started at system boot. "It took some time, but it's working now."

Read the rest of this article if you'd like your mySQL server to launch when you start your machine.

[Editor's note: I haven't installed this yet myself, but I will, and I'll comment back if I have any problems]

Instructions

NOTE: The '%' is the prompt character; do not include it as part of the command!

You'll need to be doing all of this as root, so use your favorite method of becoming root...

First, create the startup directory and files:

% cd /Library/StartupItems
% mkdir SQL
% cd SQL
% touch SQL
% touch StartupParameters.plist
% pico SQL
and enter the following:
#!/bin/sh

. /etc/rc.common
##
# Start up SQL server
##
if [ "${SQLSERVER:=-NO-}" = "-YES-" ]; then
ConsoleMessage "Starting SQL Server"
/usr/local/mysql/share/mysql/mysql.server start
fi
Save the file and quit Pico. Now we'll edit the StartupParamters.plist:
% pico StartupParameters.plist
Enter the following text:
{
Description = "secure SQL server";
Provides = ("SQL");
Requires = ("Resolver");
OrderPreference = "None";
Messages =
{
start = "Starting SQL server";
stop = "Stopping SQL server";
};
}
Save the file and quit Pico. Now we'll set the correct permissions.
% chgrp wheel SQL
% chgrp wheel StartupParameters.plist
% chmod 755 SQL
The last step is to edit the host config file:
% pico /etc/hostconfig
and enter the following line:
SQLSERVER=-YES-
i've put it between WEBSERVER and APPLETALK_HOSTNAME. Save your changes, quit Pico, exit the terminal, and reboot. After reboot, view processviewer or top in terminal and you should see mysqld and sh (for safe_mysqld) running!

wow ... took me a day :). I used the SSH login thingies from stepwise as starting point

Gwyrrdin

Comments (11)


Mac OS X Hints
http://hints.macworld.com/article.php?story=20010411170957604