HomebrewでMySQLのセットアップ
自分の作業履歴・・
インストール
brew install mysql
非力なairでmakeが恐ろしく時間かかる;;
自動起動設定
macのcronみたいの。
ln -sfv /usr/local/opt/mysql/*.plist ~/Library/LaunchAgents launchctl load -w ~/Library/LaunchAgents/homebrew.mxcl.mysql.plist
ざっくりと。。
- ユーザー用のlaunchd設定ファイル置き場に、brewがダウンロードしてきてくれた launchd設定ファイルを置く。(*.plist)
- launchctlコマンドでmysql用の設定ファイルをロードする
MySQL初期設定
ROOTパスワードの設定など。 mysql_secure_installation
を使う。
$ mysql_secure_installation Set root password? => N Remove anonymous users? => Y Disallow root login remotely? => Y Remove test database and access to it? => Y Reload privilege tables now? => Y
- ルートパスワードを設定するか? => 今回はNo (ローカル環境のテスト用なので)
- アノニマスユーザーを削除するか? => 削除する
- rootユーザーのリモートログインの禁止するか? => 禁止する
- テストデーターベースの削除するか? => 削除する
- 権限の変更を再読み込みするか? => 再読み込みする
接続出来るか確認
$ mysql -u root mysql > show databases; +--------------------+ | Database | +--------------------+ | information_schema | | mysql | | performance_schema | +--------------------+ 3 rows in set (0.00 sec) mysql > exit
よさげ。