3

I installed MySQL Community Server following instructions at

http://dev.mysql.com/doc/refman/5.0/en/macosx-installation.html

with the Startup Item and the MySQL Preference Pane.

I can stop the server with

$ /usr/local/mysql/bin/mysqladmin -u root -p shutdown 
Enter password:
$ ps aux | grep mysqld
.... grep mysqld

Is this the proper way?

Every time when I try to stop the sever using System Preference -> MySQL -> Stop MySQL Server, it hangs. I will need to force quit the System Preference from the dock. Any idea why the hang or how to find out?

1 Answer 1

2

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 protected] exists. Run these lines to create that user:

SET SQL_LOG_BIN=0;
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.

2
  • When you man service in Mac OS X 10.6.8, you can see that service is deprecated and will be removed in a future release of Mac OS X.
    – qazwsx
    May 10, 2012 at 15:40
  • how can it be start it by console?
    – jcho360
    May 10, 2012 at 20:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.