0

I've asked already this but someone decided that the question had already an answer without understood really what I need. The old question is here I want to make a script that I can run from the terminal of osx to start apache and mysql using the start command and then when I finished with them, I want to use the stop command or something similar to stop and quit from them. I don't have experience with shell scripting, will be this possible? can someone help me?

sisaln
  • 210
  • 4
  • 16

1 Answers1

1

MySQL is installed on MacOS as a launch daemon.

Here's the shell command to start and stop it:

sudo launchctl load -F /Library/LaunchDaemons/com.oracle.oss.mysql.mysqld.plist

sudo launchctl unload -F /Library/LaunchDaemons/com.oracle.oss.mysql.mysqld.plist

See https://dev.mysql.com/doc/mysql-osx-excerpt/8.0/en/osx-installation-launchd.html for more on the MySQL Launch Daemon.

An alternative way to install MySQL on MacOS is with brew. Then the usage to start and stop it is done with supervisord. Here's the way to start and stop a service managed by supervisord:

supervisorctl start mysql

supervisorctl stop mysql
Bill Karwin
  • 538,548
  • 86
  • 673
  • 828
  • I'm using this command for now that was posted inside another question. `/usr/local/mysql/support-files/mysql.server start` to start mysql. I want to avoid to launch it when the mac is started, this is why I want to create a simple script that will start my development envoirment automatically when i run it – sisaln Jan 31 '20 at 18:09