macにhomebrewでmysqlインストールメモ

ちょっとmysqlでアプリ作ってて、面倒なんでwordpress用にインストールしていたMAMPに内包されたmysqlを使ってたのですが、ちょっと設定ファイルとかの場所がよくわからないので単独でhomebrewからインストールしたんでメモっときます。自分のために。

インストール

sudo brew install mysql


インストールされたのは

/usr/local

の配下になります。


サーバスタート

mysql.server start


.bash_profileでMAMPのmysqlコマンドへのパスをコメントアウトし/usr/local/binにパスを通してこちらのmysqlを使用する。

export PATH=$JAVA_HOME/bin:$M2_HOME/bin:$PATH
#PATH export PATH=/Applications/MAMP/Library/bin:$PATH
export PATH="/usr/local/bin:$PATH"


mysqlコマンドを叩く

terubookAir:~ teru$ mysql -u root -p
Enter password: 
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 9
Server version: 5.5.27 Source distribution

Copyright (c) 2000, 2011, 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> 


サーバストップ

mysql.server stop 


O.K ! ねる!