How do you stop MySQL on a Mac OS install?

前端 未结 20 1464
暗喜
暗喜 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:36

    Try

    sudo /support-files/mysql.server start
    sudo /support-files/mysql.server stop
    

    Else try:

    sudo /Library/StartupItems/MySQLCOM/MySQLCOM start
    sudo /Library/StartupItems/MySQLCOM/MySQLCOM stop
    sudo /Library/StartupItems/MySQLCOM/MySQLCOM restart

    However, I found that the second option only worked (OS X 10.6, MySQL 5.1.50) if the .plist has been loaded with:

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

    PS: I also found that I needed to unload the .plist to get an unrelated install of MAMP-MySQL to start / stop correctly. After running running this, MAMP-MySQL starts just fine:

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

提交回复
热议问题