8 Replies Latest reply: Nov 3, 2008 2:57 PM by theRocket
Austin Sloat Level 2 Level 2 (195 points)
For some time now we have been running our web sites off of the official MySQL release (installed in /usr/local via the package release) as well as the entropy release of php5. Recently while diagnosing some other issues I noticed that the stock MySQL was trying to run-- the log was filling with messages from launchd saying that MySQL was trying to start up but couldn't because another MySQL was running.

MySQL was shown as off in Server Admin. I quit the official release to update it from a new package. The stock MySQL started up and now I can't get it to stop. Server admin can't stop it from either the GUI or the command line. It starts right up if I restart the computer even though I can't find any .plist that would indicate it is telling MySQL to start up. I really just want to kill the stock MySQL and keep it killed. Any ideas of where I should be looking.

By the way, I can't enter a root password from server admin because MySQL won't shut down.

TIA

iMac, Mac OS X (10.5.5)
  • Camelot Level 8 Level 8 (46,395 points)
    The stock MySQL daemon is managed via launchd

    Its control file is at /System/Library/LaunchDaemons/org.mysql.mysqld.plist

    You can either edit that file to add a <Disabled> key, or remove it altogether.

    That is assuming the package installer doesn't also rely on this file.
  • Austin Sloat Level 2 Level 2 (195 points)
    Thanks. I had looked there but didn't see anything Here is the content of org.mysql.mysqld.plist:

    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
    <plist version="1.0">
    <dict>
    <key>Disabled</key>
    <true/>
    <key>Label</key>
    <string>org.mysql.mysqld</string>
    <key>OnDemand</key>
    <false/>
    <key>ProgramArguments</key>
    <array>
    <string>/usr/libexec/mysqld</string>
    <string>--socket=/var/mysql/mysql.sock</string>
    <string>--user=mysql</string>
    <string>--port=3306</string>
    <string>--datadir=/var/mysql</string>
    <string>--pid-file=/var/mysql/h-72-245-196-242.snfccasy.covad.net.pid</string>
    </array>
    <key>ServiceIPC</key>
    <false/>
    </dict>
    </plist>

    I know that we are getting a bad DNS reverse that we are trying to resolve, but that was the only thing I saw in the file that seemed problematic. I do have a disabled key and OnDemand is off. Do you see anything else?

    By the way, when I run serveradmin with full status I get:

    *mysql:setStateVersion = 1*
    *mysql:defaultFilesInstalled = yes*
    *mysql:state = "RUNNING"*
    *mysql:startTime = ""*
    *mysql:logPaths:mysqlAdminLog = "/Library/Logs/MySQL.log"*
    *mysql:logPaths:mysqlServiceLog = "/var/mysql/ferrari-moe.com.err"*
    *mysql:readWriteSettingsVersion = 1*
    *mysql:databaseLocation = "/var/mysql"*
    *mysql:networkConnectAllowed = no*

    When I run +sudo serveradmin stop mysql+ I get +mysql:error = "CANNOTSTATERR"+

    I was hoping to just kill it with mysqladmin, but I get

    *mysqladmin: connect to server at 'localhost' failed*
    *error: 'Can't connect to local MySQL server through socket '/var/mysql/mysql.sock' (2)'*
    *Check that mysqld is running and that the socket: '/var/mysql/mysql.sock' exists!*

    I also don't have a mysql daemon showing up in Activity monitor

    In MySQL.log I show
    *2008-10-30 11:03:28 US/Pacific Stopping MySQL Service*
    *2008-10-30 11:03:37 US/Pacific
    Stopping MySQL daemon...*
    *2008-10-30 11:08:44 US/Pacific [E] MySQL daemon shutdown timed-out.*

    When I run serveradmin shutdown.

    Is it possible that serveradmin is just getting bad information somehow and MySQL really isn't running?

    Thanks in advance
  • Camelot Level 8 Level 8 (46,395 points)
    IIRC you can't rely on serveradmin if you've installed your own copy of apps. There's all kind of crossovers where serveradmin expects to find things in certain places and they're not there thanks to your custom install.

    If you're running your own installation then you need to run your own (or vendor-provided) scripts to manage the server and pretty much ignore what serveradmin is telling you.
  • Austin Sloat Level 2 Level 2 (195 points)
    I think that is generally true, but there should be no crossover between Apple's MySQL install and the "official" MySQL install, at least according to the documentation from both sources. Serveradmin was reporting a running mysql although according to activity manager and top there were no mysql daemons running-- either stock or official. I just decided to force the official mysql to start up and it appears that it has. Hopefully launchd won't try to start up the stock release. I move the launchdaemon plist file so we will see.
  • MrHoffman Level 6 Level 6 (13,050 points)
    I wouldn't encourage running two instances of a package on one box in parallel; any directions to the contrary, two separate versions in parallel is just asking for trouble. Certainly no overlap on the files and directories and such; it's having both versions running that I'd expect to see problems.

    Pick one, and disable the other.

    I do know of a few platforms and products that can run multiple versions in parallel (and outside of a virtual machine), but those platforms and products are rare.
  • Austin Sloat Level 2 Level 2 (195 points)
    No, I agree. I am only talking about running one.
  • Wes Plate Level 4 Level 4 (2,845 points)
    I was seeing a lot of MySQL errors in my system log which surprised me since I didn't have MySQL enabled in my Server Admin.

    I went into System Preferences and found a MySQL preference pane, it said that MySQL was running. Is this preference pane supposed to be there? I don't remember installing MySQL in the past, but maybe I did?

    Furthermore I can't turn off this MySQL, I click the Stop button but it still says it is running.

    If this isn't supposed to be there how do I uninstall it?
  • theRocket Level 1 Level 1 (15 points)
    Wes,

    If you have the plist file as discussed above, I think you will have to shut MySQL off at the command line like this (depending on location):

    sudo launchctl unload -w /Library/LaunchDaemons/com.mysql.mysqld.plist

    I get my tips from Dan Benjamin: http://hivelogic.com/articles/2007/11/installing-mysql-on-mac-os-x