(MySQLのインストールは、その後挑戦したMac OS X YosemiteへHomebrewをインストールであっさり成功しました。お急ぎの場合は新しい記事をごらんください。)
先に行き詰まったところから、MacPortsのアップデートに成功したので
MacPorts で MySQL のインストールを再開。
とりあえず、最初のコマンドからやり直してみようか。
$ sudo port install mysql5 +server Password: ---> Computing dependencies for mysql5 ---> Cleaning mysql5
順調なようだ。
続いて次のコマンド
$ sudo port upgrade installed
No such file or directory とか
[Warning] Can’t create test file とか
[ERROR] Aborting とか出とる…。
アカンかったか。
むー…パーミッション違いとか、基本的なところでつまづいてるのかな。
調べてみたところ、同じ目にあった方がいらっしゃった。
参考サイト:
Mac OS X 10.7.3 に MySQL をインストールする
同じコマンドを実行してみた
$ sudo mysql_install_db5
お!これは上手くいっているかも!!
$ sudo mysql_install_db5 Password: Installing MySQL system tables... OK Filling help tables... 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: /opt/local/lib/mysql5/bin/mysqladmin -u root password 'new-password' /opt/local/lib/mysql5/bin/mysqladmin -u root -h ***** password 'new-password' Alternatively you can run: /opt/local/lib/mysql5/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 /opt/local ; /opt/local/lib/mysql5/bin/mysqld_safe & You can test the MySQL daemon with mysql-test-run.pl cd /opt/local/mysql-test ; perl mysql-test-run.pl Please report any problems with the /opt/local/lib/mysql5/bin/mysqlbug script!
よく見ると「まずこれを実行しなよ!」っぽく何か書いてある
この先、いちいち /opt/local/… とやっていくのが煩わしくなってきたので
いったんMySQLのフォルダまでpathを通した。
さあ実行。
$ mysqladmin -u root password '*******' mysqladmin: connect to server at 'localhost' failed error: 'Can't connect to local MySQL server through socket '/opt/local/var/run/mysql5/mysqld.sock' (2)' Check that mysqld is running and that the socket: '/opt/local/var/run/mysql5/mysqld.sock' exists!
またエラーか…
どうやら、MySQLサーバが起動していないようだ。
参考サイト:
「Can’t connect to local MySQL server through socket」エラーについて
なるほど。
起動コマンドを実行してみる。
$ /opt/local/lib/mysql5/bin/mysqld_safe &
またエラーが。
$ /opt/local/lib/mysql5/bin/mysqld_safe & [2] 67764 $ 120509 18:41:49 mysqld_safe Logging to '/opt/local/var/db/mysql5/*****.err'. touch: /opt/local/var/db/mysql5/*****.err: Permission denied chown: /opt/local/var/db/mysql5/*****.err: Permission denied mkdir: /opt/local/var/run: No such file or directory chown: /opt/local/var/run/mysql5: No such file or directory chmod: /opt/local/var/run/mysql5: No such file or directory 120509 18:41:49 mysqld_safe Starting mysqld daemon with databases from /opt/local/var/db/mysql5 /opt/local/lib/mysql5/bin/mysqld_safe: line 100: /opt/local/var/db/mysql5/*****.err: Permission denied rm: /opt/local/var/db/mysql5/*****.pid: Permission denied /opt/local/lib/mysql5/bin/mysqld_safe: line 137: /opt/local/var/db/mysql5/*****.err: Permission denied 120509 18:41:49 mysqld_safe mysqld from pid file /opt/local/var/db/mysql5/*****.pid ended /opt/local/lib/mysql5/bin/mysqld_safe: line 100: /opt/local/var/db/mysql5/*****.err: Permission denied [2]+ Exit 1 /opt/local/lib/mysql5/bin/mysqld_safe
ソケットに問題があるようだ。
行き詰まってきたので、いったん全部アンインストールして最初からやり直してみよう…。
「Mac OSX に MySQL をインストール(リセット編)」に続く…
MySQLをアンインストールしてしまってから見つけたのだが
日本MySQLユーザ会さんのドキュメントをみていたら、該当する解説があった。
参考サイト:
MySQL サーバー起動時の問題
うわー、このへんかな〜という心当たりがいくつか…(hostsのくだりとか)
なぜ先に見に行かなかったのだ。
これからやる、2週目のチャレンジでためしてみよう。