Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

brew services start mysql vs mysql.server start

Tags:

mysql

homebrew

What is the difference between those two below?

brew services start mysql

mysql.server start

I am using homebrew mac os mysql(5.7.21).

If I turn on the mysql server using a command

brew services start mysql

then check if that mysql server is on,

brew services list

The result is

mysql started

By the way, If I turn on the mysql server using a command

mysql.server start

then check if that mysql server is on,

brew services list

The result is

mysql stopped

Both of them successfully turn on the mysql server.

I have checked it using a command

lsof -i:3306

But why is that brewlist status different?

I only installed mysql via homebrew.

brew install mysql

so I guesssed that mysql.server start command also would be related to the homebrew mysql.

Any advice would be appreciated.

like image 751
jwkoo Avatar asked Mar 07 '18 17:03

jwkoo


People also ask

How do I start MySQL server on Mac?

Open macOS system preferences and select the MySQL preference panel, and then execute Start MySQL Server. The Instances page includes an option to start or stop MySQL, and Initialize Database recreates the data/ directory.

What command is used to start MySQL service?

d command to start/stop your MySQL server. Lastly, you can also use the systemctl command to start, stop, and restart applications on Linux, including MySQL.


1 Answers

brew services (services in general) will restart automatically after rebooting; the other (mysql.server start) will not. That is the difference. Executing the command with no options should yield,

tigger2:Downloads efrisch$ brew services
brew services [-v|--verbose] [list | run | start | stop | restart | cleanup] [...]
Easily start and stop formulae via launchctl.
With -v or --verbose, print more detail.

Integrates Homebrew formulae with macOS' launchctl manager. Services can be
added to either /Library/LaunchDaemons or ~/Library/LaunchAgents.
Basically, items in /Library/LaunchDaemons are started at boot, while those
in ~/Library/LaunchAgents are started at login.
like image 104
Elliott Frisch Avatar answered Sep 17 '22 17:09

Elliott Frisch