mysqlのinstall for macports

yosemite

install

$ sudo port install mysql56-server
$ sudo /opt/local/lib/mysql56/bin/mysql_install_db --user _mysql
$ /opt/local/lib/mysql56/bin/mysqladmin -u root password ''

setting PATH

$ mysql 
~mysql
$ mysql -u root
zsh: command not found: mysql
$ port select mysql
Available versions for mysql:
    mysql56
    none (active)
$ sudo port select mysql mysql56
Selecting 'mysql56' for 'mysql' succeeded. 'mysql56' is now active.
$ mysql
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/opt/local/var/run/mysql56/mysqld.sock' (2)

start mysql

$ ls /Library/LaunchDaemons/
$ sudo launchctl load -w /Library/LaunchDaemons/org.macports.mysql56-server.plist
$ sudo launchctl list | grep mysql
61465   0   org.macports.mysql56-server
$ sudo launchctl start org.macports.mysql56-server
$ mysql -uroot                                    
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 5.6.23 Source distribution

Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> \q
Bye

参考

http://qiita.com/domekichi/items/8d0427ceabdcf49ebc47
http://d.hatena.ne.jp/kanonji/20100621/1277075926

$ sudo launchctl stop org.macports.mysql56-server してもすぐにプロセスが立ち上がるのでlaunchdが機能していないと思ったら、
plistに書いているkeepAliveがtrueなので正常な動作でした。