How do you stop MySQL on a Mac OS install?

前端 未结 20 1432
暗喜
暗喜 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条回答
  • 2020-11-30 16:41

    After try all those command line, and it is not work.I have to do following stuff:

    mv /usr/local/Cellar/mysql/5.7.16/bin/mysqld /usr/local/Cellar/mysql/5.7.16/bin/mysqld.bak
    mysql.server stop
    

    This way works, the mysqld process is gone. but the /var/log/system.log have a lot of rubbish:

    Jul  9 14:10:54 xxx com.apple.xpc.launchd[1] (homebrew.mxcl.mysql[78049]): Service exited with abnormal code: 1
    Jul  9 14:10:54 xxx com.apple.xpc.launchd[1] (homebrew.mxcl.mysql): Service only ran for 0 seconds. Pushing respawn out by 10 seconds.
    
    0 讨论(0)
  • 2020-11-30 16:43

    You can always use command "mysqladmin shutdown"

    0 讨论(0)
  • 2020-11-30 16:43

    If you installed the MySQL 5 package with MacPorts:

    sudo launchctl  unload -w /Library/LaunchDaemons/org.macports.mysql.plist 
    

    Or

    sudo launchctl  unload -w /Library/LaunchDaemons/org.macports.mysql5-devel.plist 
    

    if you installed the mysql5-devel package.

    0 讨论(0)
  • 2020-11-30 16:44

    Latest OSX (10.8) and mysql 5.6, the file is under Launch Daemons and is com.oracle.oss.mysql.mysqld.plist. It presents an option under System Options, usually the bottom of the list. So go to system settings, click on Mysql, and turn it off from the option box. https://dev.mysql.com/doc/refman/5.6/en/osx-installation-launchd.html

    0 讨论(0)
  • 2020-11-30 16:45

    For me it's working with a "mysql5"

    sudo launchctl unload -w /Library/LaunchDaemons/org.macports.mysql5.plist
    sudo launchctl load -w /Library/LaunchDaemons/org.macports.mysql5.plist
    
    0 讨论(0)
  • 2020-11-30 16:48

    If you are using homebrew you can use

    brew services restart mysql
    brew services start mysql
    brew services stop mysql
    

    for a list of available services

    brew services list
    
    0 讨论(0)
提交回复
热议问题