まずまとめ
この時はこれで動きました
- brewでmysql(他)を削除&再インストール
- databeseを作る→
mysql_install_db --basedir="$(brew --prefix mysql)" --datadir=/usr/local/var/mysql
- 最終的にはこれ →
sudo /usr/local/opt/mysql/bin/mysqld_safe &
ログ
(´-`).。oO( もういいや、消そう
# 消す % sudo brew uninstall mysql # 入れようとする % sudo brew install mysql # ぉこされたからフォーミュラをアップグレードする % sudo brew upgrade mysql # さらにぉこされた # CommandLineToolsが古いとかなんとか # 言われた通りのコマンドを打つ % xcode-select install # Macソフトウェアアップデートのアプリケーションが起動する # CommadnLineToolsがインストールされる % sudo brew install mysql # なんかぉこされた
Macの再起動でもすっか、っつって再起動する
[18:31:00] → sudo brew install mysql Password: Warning: A newer Command Line Tools release is available Update them from Software Update in the App Store. ==> Downloading https://downloads.sf.net/project/machomebrew/Bottles/mysql-5.6.16.mavericks.bottle.tar.gz ######################################################################## 100.0% ==> Pouring mysql-5.6.16.mavericks.bottle.tar.gz ==> Caveats 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 ==> Summary 🍺 /usr/local/Cellar/mysql/5.6.16: 9424 files, 349M
お、入った?
% which mysql /usr/local/bin/mysql % which mysqld_safe /usr/local/bin/mysqld_safe % which mysql.server /usr/local/bin/mysql.server
それっぽいものは入ってる
% sudo mysqld_safe Password: 140315 18:39:18 mysqld_safe Logging to '/usr/local/var/mysql/otiai.local.err'. 140315 18:39:18 mysqld_safe Starting mysqld daemon with databases from /usr/local/var/mysql 140315 18:39:18 mysqld_safe mysqld from pid file /usr/local/var/mysql/otiai.local.pid ended
おい、またこれか
% sudo mysql.server start Starting MySQL . ERROR! The server quit without updating PID file (/usr/local/var/mysql/otiai.local.pid).
うーむ。これか?
% mysql_install_db --basedir="$(brew --prefix mysql)" --datadir=/usr/local/var/mysql WARNING: Could not write to config file /usr/local/opt/mysql/my-new.cnf: Permission denied # 以下略 % sudo mysql_install_db --basedir="$(brew --prefix mysql)" --datadir=/usr/local/var/mysql Installing MySQL system tables...2014-03-15 18:48:08 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details). 2014-03-15 18:48:08 3859 [Note] InnoDB: Using atomics to ref count buffer pool pages # 中略 2014-03-15 18:48:09 3859 [Note] InnoDB: Starting shutdown... 2014-03-15 18:48:10 3859 [Note] InnoDB: Shutdown completed; log sequence number 1625997 OK Filling help tables...2014-03-15 18:48:10 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details). # 中略 2014-03-15 18:48:10 3864 [Note] InnoDB: Starting shutdown... 2014-03-15 18:48:11 3864 [Note] InnoDB: Shutdown completed; log sequence number 1626007 OK To start mysqld at boot time you have to copy support-files/mysql.server to the right place for your system PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER ! To do so, start the server, then issue the following commands: /usr/local/opt/mysql/bin/mysqladmin -u root password 'new-password' /usr/local/opt/mysql/bin/mysqladmin -u root -h otiai.local password 'new-password' Alternatively you can run: /usr/local/opt/mysql/bin/mysql_secure_installation which will also give you the option of removing the test databases and anonymous user created by default. This is strongly recommended for production servers. See the manual for more instructions. You can start the MySQL daemon with: cd . ; /usr/local/opt/mysql/bin/mysqld_safe & You can test the MySQL daemon with mysql-test-run.pl cd mysql-test ; perl mysql-test-run.pl Please report any problems at http://bugs.mysql.com/ The latest information about MySQL is available on the web at http://www.mysql.com Support MySQL by buying support/licenses at http://shop.mysql.com WARNING: Found existing config file /usr/local/opt/mysql/my.cnf on the system. Because this file might be in use, it was not replaced, but was used in bootstrap (unless you used --defaults-file) and when you later start the server. The new default config file was created as /usr/local/opt/mysql/my-new.cnf, please compare it with your file and take the changes you need.
良い雰囲気ある。↑これを熟読するべき。起動は?
% mysql.server Usage: mysql.server {start|stop|restart|reload|force-reload|status} [ MySQL server options ] % mysql.server start Starting MySQL . ERROR! The server quit without updating PID file (/usr/local/var/mysql/otiai.local.pid).
起動方法にバリエーションがあんの?
% cd . ;/usr/local/opt/mysql/bin/mysqld_safe & [1] 3991 % 140315 18:50:18 mysqld_safe Logging to '/usr/local/var/mysql/otiai.local.err'. 140315 18:50:18 mysqld_safe Starting mysqld daemon with databases from /usr/local/var/mysql /usr/local/opt/mysql/bin/mysqld_safe: line 129: /usr/local/var/mysql/otiai.local.err: Permission denied /usr/local/opt/mysql/bin/mysqld_safe: line 166: /usr/local/var/mysql/otiai.local.err: Permission denied 140315 18:50:18 mysqld_safe mysqld from pid file /usr/local/var/mysql/otiai.local.pid ended /usr/local/opt/mysql/bin/mysqld_safe: line 129: /usr/local/var/mysql/otiai.local.err: Permission denied [1] + exit 1 /usr/local/opt/mysql/bin/mysqld_safe
パーミッションか。もう一息っぽい
% cd . ; sudo /usr/local/opt/mysql/bin/mysqld_safe & [1] 4157 % 140315 18:50:33 mysqld_safe Logging to '/usr/local/var/mysql/otiai.local.err'. 140315 18:50:33 mysqld_safe Starting mysqld daemon with databases from /usr/local/var/mysql %
お、これは行けたのでは?
立った
% mysql -u root Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 1 Server version: 5.6.16 Homebrew Copyright (c) 2000, 2014, 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> exit Bye
雑感
- ローカルのMySQLって使うときと使わないときの差が激しいから毎回初期化とかする作業が発生する印象ある。つーかルートユーザのパスワードとか忘れる。
- とにかく出力をちゃんと落ち着いて読んで行動するべきですね、ハイ
DRYな備忘録