Take the 2-minute tour ×
Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. It's 100% free, no registration required.

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?

share|improve this question

1 Answer 1

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 root@127.0.0.1 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.

share|improve this answer
    
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. –  Problemania May 10 '12 at 15:40
    
how can it be start it by console? –  jcho360 May 10 '12 at 20:38

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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