I was having an issue running a mysql
command and saw suggestions on a few issues online that suggested using the service
command and it seemed to be that it was something that I should have by default.
I had been installing a few homebrew packages, so I'm not sure if that could have caused it? I have never used this command before, so I'm not entirely sure.
Attempting to run the command sudo service mysql start
returns
sudo: service: command not found
I have not got much experience using the terminal, so apologies. I saw a lot of comments suggesting that the service command is located in /usr/sbin/
and also possibly /sbin/service
but I could not find it in either.
my .bash_profile is as follows
export PATH=~/.composer/vendor/bin:$PATH
export PATH=/usr/local/php5/bin:$PATH
export ANDROID_HOME=$HOME/Library/Android/sdk
export PATH=$PATH:$ANDROID_HOME/emulator
export PATH=$PATH:$ANDROID_HOME/tools
export PATH=$PATH:$ANDROID_HOME/tools/bin
export PATH=$PATH:$ANDROID_HOME/platform-tools
export PATH=$PATH:/home/user/bin
export PATH=$PATH:/sbin
The two exports at the bottom were from suggestions in other questions but neither seemed to work.
Any ideas? Any help would be greatly appreciated.
Best Answer
The
service
command is specific to certain Linux distributions. It is not used on macOS.If you installed MySQL through Homebrew, you can start and stop it using the commands: