Mysql does not start automatically - how to fix?

Posted:
in Genius Bar edited January 2014
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? ]

Comments

  • Reply 1 of 4
    I used Mark Liyanage's startup item, and it works fine. This is what I have:



    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]&lt;?xml version="1.0" encoding="UTF-8"?&gt;

    &lt;!DOCTYPE plist SYSTEM "file://localhost/System/Library/DTDs/PropertyList.dtd"&gt;

    &lt;plist version="0.9"&gt;

    &lt;dict&gt;

    &lt;key&gt;Starting MySQL&lt;/key&gt;

    &lt;string&gt;Starting MySQL&lt;/string&gt;

    &lt;/dict&gt;

    &lt;/plist&gt;</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>
  • Reply 2 of 4
    giaguaragiaguara Posts: 2,724member
    tried.. seems not to have worked = still not starting automatically. tried, retried, retried...



    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>
  • Reply 3 of 4
    robsterrobster Posts: 256member
    There's one more thing you need to do....



    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
  • Reply 4 of 4
    giaguaragiaguara Posts: 2,724member
    .. changing from apache 2 to apache and fixing some other things resolved that.

    thanx pieman and robster.
Sign In or Register to comment.