Mysql does not start automatically - how to fix?
How to make mysql start automatically?
The problem / situation is a mac with jaguar, apache, mysql, php and a forum hosted ( phpbb2 ) - the problem is that mysql does not start automatically.
In the folder of mysql there was a folder that was required to be copied to the folder of the automatic start of the system. And under X there is the StartupItems in System/Library/.. the file is copied in the required place but it does not want to start automatically. Where is the problem or what can be wrong? The autostart of mysql would be essential for the forum, in case the power qoes away for a while it should start automatically once the situation normalizes...
[ Brad, help? ]
The problem / situation is a mac with jaguar, apache, mysql, php and a forum hosted ( phpbb2 ) - the problem is that mysql does not start automatically.
In the folder of mysql there was a folder that was required to be copied to the folder of the automatic start of the system. And under X there is the StartupItems in System/Library/.. the file is copied in the required place but it does not want to start automatically. Where is the problem or what can be wrong? The autostart of mysql would be essential for the forum, in case the power qoes away for a while it should start automatically once the situation normalizes...
[ Brad, help? ]
Comments
In /Library/StartupItems/
a directory named MySQL which contains the following items:
a plain text file named "MySQL" which contains this code (modify to match the name of the user MySQL runs as:
[code]
. /etc/rc.common
if [ "${MYSQL:=-YES-}" = "-YES-" ]; then
ConsoleMessage "Starting MySQL database server"
cd /usr/local/
REALDIR=`perl -e 'print readlink "mysql"'`
cd $REALDIR
if [ -e ./bin/safe_mysqld ]
then
./bin/safe_mysqld --user=mysql &
elif [ -e ./bin/mysqld_safe ]
then
./bin/mysqld_safe --user=mysql &
else
ConsoleMessage "Found neither safe_mysqld nor mysqld_safe"
fi
fi
</pre><hr></blockquote>
Then there is the plist file named StartupParameters.plist which contains this code:
[code]{
Description = "MySQL database server";
Provides = ("MySQL");
Requires = ("Resolver");
Preference = "Late";
Messages =
{
start = "Starting MySQL";
stop = "Stopping MySQL";
};
}
</pre><hr></blockquote>
The last item is a directory named "Resources" which contains localization files. The English localization is a directory named "English.lproj" and it contains a plain text file named "Localizable.strings" (so the path is /Library/StartupItems/MySQL/Resources/English.lproj/Localizable.strings
It contains this code:
[code]<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist SYSTEM "file://localhost/System/Library/DTDs/PropertyList.dtd">
<plist version="0.9">
<dict>
<key>Starting MySQL</key>
<string>Starting MySQL</string>
</dict>
</plist></pre><hr></blockquote>
Check out your startup files - I would imagine matching this setup should work fine (obviously adding any localization you might use, and modifying the "MySQL" file to match your MySQL user.
Good lucK!
EDIT: to clean up some code
[ 11-03-2002: Message edited by: The Pie Man ]</p>
that file so far
[quote]#!/bin/sh
##
# Apache HTTP Server
##
. /etc/rc.common
StartService ()
{
if [ "${WEBSERVER:=-NO-}" = "-YES-" ]; then
ConsoleMessage "Starting Apache web server"
apachectl start
fi
}
StopService ()
{
ConsoleMessage "Stopping Apache web server"
apachectl stop
}
RestartService ()
{
if [ "${WEBSERVER:=-NO-}" = "-YES-" ]; then
ConsoleMessage "Restarting Apache web server"
apachectl restart
else
StopService
fi
}
RunService "$1"<hr></blockquote>
[i can't figure this out, not having mysql on mine, simply hosted at univ. linux = no idea.]
[though notice the differences.]
what can it still be?
<img src="graemlins/hmmm.gif" border="0" alt="[Hmmm]" />
[ 11-03-2002: Message edited by: Mulattabianca ]</p>
Open the etc/hostconfig file in BBEdit or similar, then add the following, under the *Services list,if it's not there already:
MYSQLSERVER=-YES-
Then restart
thanx pieman and robster.