DISCLAIMER : Not a MacOS user
That is an alternative way. This shutdown method can be done in MacOS, Linux, Windows, any platform MySQL is supported in.
I actually prefer your mysqladmin method for a reason...
In Linux, I have seen the
mysql.sock (the socket file) file just up and disappear without warning. The standard way to shutdown mysql in Linux is
service mysql stop. Whenever the socket file disappears, the mysqld_safe program cannot shutdown without first seeing in the socket file. Such a standard shutdown would just hang.
I usually connect using TCP/IP
/usr/local/mysql/bin/mysqladmin -u root -h127.0.0.1 -p shutdown
Doing it this way bypasses checking for a socket file. Of course, you must make sure email@example.com exists. Run these lines to create that user:
GRANT ALL PRIVILEGES ON *.* TO root@'127.0.0.1' IDENTIFIED BY 'whateverpassword';
CAVEAT If you do
DESC mysql.user;, you will see that one of the privilege columns is
Shutdown_priv. This evidently would permit a user who connects to mysqladmin to issue a shutdown. Users with this privilege cannot issue a shutdown from the mysql client. Users with shutdown_priv='Y' can only be done from mysqladmin.