&tag(Homebrew/mysql); *目次 [#id978086] #contents *参考情報 [#r126b57e] -[[Homebrew]] *5.6のインストール [#u945690f] -普通にインストールすると、5.6が入る brew install mysql -設定ファイルをコピー。mysql --help | grep my.cnfで表示された場所に置く。/etc/my.cnf /etc/mysql/my.cnf /usr/local/etc/my.cnf ~/.my.cnfだったので、/usr/local/etc/my.cnf にした。 cp /usr/local/Cellar/mysql/5.6.10/support-files/my-default.cnf /usr/local/etc/my.cnf -データベース初期化。 mysql_install_db --verbose --user=`whoami` --basedir="$(brew --prefix mysql)" --datadir=/usr/local/var/mysql --tmpdir=/tmp **自動起動 [#pabdf864] -/usr/local/opt/mysql/homebrew.mxcl.httpd.plistを編集。KeepAliveをfalseにしておく。falseじゃないと、mysql.server start/stop/restartが上手く動かない(PIDファイルがどうのこうのいわれる)。 -plistを登録する。 ln -sfv /usr/local/opt/mysql/*.plist ~/Library/LaunchAgents launchctl load -w ~/Library/LaunchAgents/homebrew.mxcl.mysql.plist **サーバー起動 [#wbecb597] -mysql.serverコマンドで操作できる。 mysql.server start **rootのパスワード設定 [#s0cda662] -mysqladminを使う mysqladmin -uroot password *5.5.29(古いバージョンの)インストール [#s0900ce8] -バージョンを確認 #pre{{ $ brew versions mysql 5.6.10 git checkout 3bffe56 Library/Formula/mysql.rb 5.5.29 git checkout 336c976 Library/Formula/mysql.rb 5.5.28 git checkout 5825f62 Library/Formula/mysql.rb 5.5.27 git checkout 93aecfa Library/Formula/mysql.rb }} -古いバージョンをチェックアウト。例えば5.5.29の場合 #pre{{ $ cd /usr/local $ git checkout 336c976 Library/Formula/mysql.rb }} -インストール $ brew install mysql -以下の手順でインストール後の処理を行う #pre{{ Set up databases to run AS YOUR USER ACCOUNT with: unset TMPDIR mysql_install_db --verbose --user=`whoami` --basedir="$(brew --prefix mysql)" --datadir=/usr/local/var/mysql --tmpdir=/tmp To set up base tables in another folder, or use a different user to run mysqld, view the help for mysql_install_db: mysql_install_db --help and view the MySQL documentation: * http://dev.mysql.com/doc/refman/5.5/en/mysql-install-db.html * http://dev.mysql.com/doc/refman/5.5/en/default-privileges.html To run as, for instance, user "mysql", you may need to `sudo`: sudo mysql_install_db ...options... A "/etc/my.cnf" from another install may interfere with a Homebrew-built server starting up correctly. To connect: mysql -uroot To have launchd start mysql at login: ln -sfv /usr/local/opt/mysql/*.plist ~/Library/LaunchAgents Then to load mysql now: launchctl load ~/Library/LaunchAgents/homebrew.mxcl.mysql.plist Or, if you don't want/need launchctl, you can just run: mysql.server start }} --データベースをインストールする $ mysql_install_db --verbose --user=`whoami` --basedir="$(brew --prefix mysql)" --datadir=/usr/local/var/mysql --tmpdir=/tmp --my.cnfをコピーし、utf-8設定にする。 $ cp /usr/local/Cellar/mysql/5.5.29/support-files/my-medium.cnf /usr/local/etc/my.cnf --自動起動&起動 $ ln -sfv /usr/local/opt/mysql/*.plist ~/Library/LaunchAgents $ launchctl load -w ~/Library/LaunchAgents/homebrew.mxcl.mysql.plist --パスワードの変更 $ /usr/local/opt/mysql/bin/mysqladmin -uroot password