How do you stop MySQL on a Mac OS install?

前端 未结 20 1446
暗喜
暗喜 2020-11-30 16:08

I installed MySQL via MacPorts. What is the command I need to stop the server (I need to test how my application behave when MySQL is dead)?

20条回答
  •  萌比男神i
    2020-11-30 16:34

    I installed mysql5 and mysql55 over macports. For me the mentioned files here are located at the following places:

    (mysql55-server) /opt/local/etc/LaunchDaemons/org.macports.mysql55-server/org.macports.mysql55-server.plist

    (mysql5) /opt/local/etc/LaunchDaemons/org.macports.mysql5/org.macports.mysql5.plist

    So stopping for these works like this:

    mysql55-server:

    sudo launchctl unload -w /opt/local/etc/LaunchDaemons/org.macports.mysql55-server/org.macports.mysql55-server.plist
    

    mysql5:

    sudo launchctl unload -w /opt/local/etc/LaunchDaemons/org.macports.mysql5/org.macports.mysql5.plist 
    

    You can check if the service is still running with:

    ps ax | grep mysql
    

    Further you can check the log files in my case here:

    mysql55-server

    sudo tail -n 100 /opt/local/var/db/mysql55/-MacBook-Pro.local.err
    ...
    130213 08:56:41 mysqld_safe mysqld from pid file /opt/local/var/db/mysql55/-MacBook-Pro.local.pid ended
    

    mysql5:

    sudo tail -n 100 /opt/local/var/db/mysql5/-MacBook-Pro.local.err
    ...
    130213 09:23:57  mysqld ended
    

提交回复
热议问题