【HomeBrew】mysqlインストール
メーリクリスマスイブ(。´・ε・`。)
brewコマンドでmysqlいれますた。
今日じゃないけど。
なんかドキュメントが親切でとても助かった。
こーゆードキュメントの素晴らしさが思考停止へと
わたしを引きずり込んでいくのだろうけども。
$ brew install mysql
とかやると、こんな感じのメッセージがたくさんでてくる。
ほんと、この通りにやればいい。
まず、このへんはスルー。
Warning: Xcode is not installed! Builds may fail!
==> Downloading http://downloads.mysql.com/archives/mysql-5.5/mysql-5.5.15.tar.gz
File already downloaded in /Users/hogehoge/Library/Caches/Homebrew
==> Patching
patching file scripts/mysqld_safe.sh
Hunk #1 succeeded at 555 (offset 172 lines).
patching file scripts/mysql_config.sh
Hunk #1 succeeded at 137 (offset 5 lines).
patching file configure.cmake
==> cmake . -DCMAKE_INSTALL_PREFIX=/usr/local/Cellar/mysql/5.5.15 -DMYSQL_DATADIR=/usr/local/var/mysql -DINSTALL_MANDIR=/usr/local/Cellar/mysql/5.5.15/share/man -DINSTALL_DOCDIR=/usr/local/Cellar/mysql/5.
==> make
==> make install
==> Caveats
ここから。セットアップしていきますぜ。
この青い部分のコマンドをまんま打てばよい
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 mysqld_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
で、最初の設定が終わったので、mysqlを起動する。
rootユーザになって、これも下に書いてる青色のコマンドをたたいて起動すれば良い
To run as, for instance, user "mysql", you may need to `sudo`:
sudo mysql_install_db ...options...
Start mysqld manually with:
mysql.server start
Note: if this fails, you probably forgot to run the first two steps up above
A "/etc/my.cnf" from another install may interfere with a Homebrew-built
server starting up correctly.
mysqlに接続。
To connect:
mysql -uroot
のだけど、その際に、次の設定をする必要がある。
初めてmysqlをインストールした人はこっちの設定。
To launch on startup:
if this is your first install:
mkdir -p ~/Library/LaunchAgents
cp /usr/local/Cellar/mysql/5.5.15/com.mysql.mysqld.plist ~/Library/LaunchAgents/
launchctl load -w ~/Library/LaunchAgents/com.mysql.mysqld.plist
過去にインストールした人はこっち。
if this is an upgrade and you already have the com.mysql.mysqld.plist loaded:
launchctl unload -w ~/Library/LaunchAgents/com.mysql.mysqld.plist
cp /usr/local/Cellar/mysql/5.5.15/com.mysql.mysqld.plist ~/Library/LaunchAgents/
launchctl load -w ~/Library/LaunchAgents/com.mysql.mysqld.plist
You may also need to edit the plist to use the correct "UserName".
親切だな。。(・∀・)♪
そして、わたしのブログの不親切さに驚愕|д゚)チラッ