I installed MySQL using homebrew brew install mysql, and I noticed that MySQL can be managed with two different methods:
brew services start mysql
According to the help message of brew services, when you run
brew services start mysql
it installs and starts the service formula at login (or at boot if you run the command with sudo). It means you will have now a plist file in ~/Library/LaunchAgents (or in /Library/LaunchDaemons if you run the command with sudo). For mysql, the plist file is the following:
KeepAlive
Label
homebrew.mxcl.mysql
ProgramArguments
/usr/local/opt/mysql/bin/mysqld_safe
--bind-address=127.0.0.1
--datadir=/usr/local/var/mysql
RunAtLoad
WorkingDirectory
/usr/local/var/mysql
it means that by default mysqld_safe is called with the --bind-address=127.0.0.1 and --datadir=/usr/local/var/mysql command line options.
when you run
mysql.server start
you directly execute the mysql script located in /usr/local/bin/mysql.server.
The main difference is that with the brew services version, you run mysqld_safe which, according to its man page:
adds some safety features such as restarting the server when an error occurs and logging runtime information to an error log file.