私物のMacBook AirにMySQLをインストールしました。せっかくなので手順をメモしておきます。
インストール自体はHomebrewでコマンド一発です。
1 $ brew install mysql 2 Warning: It appears you have MacPorts or Fink installed.3 Software installed with other package managers causes known problems for 4 Homebrew. If a formula fails to build, uninstall MacPorts/F ink and try again. 5 ==> Downloadin g https://do wnloads.sf .net/proje ct/machome brew/Bottl es/mysql-5 .6.1 6 ######################################################################## 100.0% 7 ==> Pouring mysql-5.6. 15.maveric ks.bottle. tar.gz 8 ==> Caveats 9 A "/etc/my.cn f" from another install may interfere with a Homebrew-b uilt 10 server starting up correctly. 11 12 To connect: 13 mysql -uroot 14 15 To have launchd start mysql at login: 16 ln -sfv /usr/local /opt/mysql /*.plist ~/Library/L aunchAgent s 17 Then to load mysql now: 18 launchctl load ~/Library/L aunchAgent s/homebrew .mxcl.mysq l.plist 19 Or, if you don't want/need launchctl, you can just run: 20 mysql.serv er start 21 ==> /usr/local /Cellar/my sql/5.6.15 /bin/mysql _install_d b --verbose --user=aka numa 22 ==> Summary 23 /usr/local /Cellar/my sql/5.6.15 : 9410 files, 349M
インストール後の各手順については上記のインストール時の出力に示されています。
まずOS起動時にMySQLが起動するように設定します。
1 $ ln -sfv /usr/local/opt/mysql /*.plist ~/Library/L aunchAgent s 2 /Users/aka numa/Libra ry/LaunchA gents/home brew.mxcl. mysql.plis t -> /usr/local /opt/mysql /homebrew. mxcl.mysql .plist
launchctlコマンドで起動します。
1 $ launchctl load ~/Library/LaunchAgent s/homebrew .mxcl.mysq l.plist 2 $ ps aux | grep mysql 3 akanuma 2558 0.0 0.0 2423468 332 s000 R+ 10:54PM 0:00.00 grep mysql 4 akanuma 2555 0.0 5.3 3081112 448512 ?? S 10:54PM 0:00.40 /usr/local /Cellar/my sql/5.6.15 /bin/mysql d --basedir= /usr/local /Cellar/my sql/5.6.15 --datadir= /usr/local /var/mysql --plugin-d ir=/usr/lo cal/Cellar /mysql/5.6 .15/lib/pl ugin --bind-add ress=127.0 .0.1 --log-erro r=/usr/loc al/var/mys ql/Hiroaki s-MacBook- Air.local. err --pid-file =/usr/loca l/var/mysq l/Hiroakis -MacBook-A ir.local.p id 5 akanuma 2467 0.0 0.0 2436436 1008 ?? S 10:54PM 0:00.02 /bin/sh /usr/local /opt/mysql /bin/mysql d_safe --bind-add ress=127.0 .0.1
mysqlコマンドで接続できることを確認します。
1 $ mysql -uroot 2 Welcome to the MySQL monitor. Commands end with ; or \g. 3 Your MySQL connectionid is 1 4 Server version: 5.6.15 Homebrew 5 6 Copyright (c) 2000, 2013, Oracle and/or its affiliates . All rights reserved. 7 8 Oracle is a registered trademark of Oracle Corporatio n and/or its 9 affiliates . Other names may be trademarks of their respective 10 owners. 11 12 Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
posted by
akanuma
on Tue 10 Dec 2013
at 23:15