How do you stop MySQL on a Mac OS install?

前端 未结 20 1453
暗喜
暗喜 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

    There are different cases depending on whether you installed MySQL with the official binary installer, using MacPorts, or using Homebrew:

    Homebrew

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

    MacPorts

    sudo port load mysql57-server
    sudo port unload mysql57-server
    

    Note: this is persistent after a reboot.

    Binary installer

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

提交回复
热议问题