goでmysqlを使おうとしていて別のところでハマりました。
mysqlを起動してテーブルを確認しようとするとcommand not foundに。。
以下に解決策を示しておきます。
/usr/local/share/man/man8の権限書き換え
結論からいうと
sudo chown -R <username> /usr/local brew link mysql
で直りました。
環境は下記です。
解決までの道のり
mysqlをインストールしているはずなのに、mysqlをターミナルで打つと
mysql: command not found
が表示されて、困っていました。
brew list
してみてもしっかりmysqlは含まれています。
とりあえずbrew update
してみたり、mysqlの再インストールしてみたけれども全く効果がありませんでした。
こんなときは便利コマンドのbrew doctor
を打ってみるとそれらしき情報が
Warning: Some directories in /usr/local/share/man aren't writable. This can happen if you "sudo make install" software that isn't managed by Homebrew. If a brew tries to add locale information to one of these directories, then the install will fail during the link step. You should probably `sudo chown -R $(whoami)` them: /usr/local/share/man/man8 Warning: You have unlinked kegs in your Cellar Leaving kegs unlinked can lead to build-trouble and cause brews that depend on those kegs to fail to run properly once built. Run `brew link` on these: mysql
しっかりwarning出ていますね。ということで /usr/local
の権限を書き換えることに。
ここで一番上のコマンドを打ちました。
sudo chown -R <username> /usr/local/share brew link mysql
あと記事を書くときにterminalのログを見直してみると
mysqlの再インストール時にがっつりErrorが出ていました。。
ちゃんとメッセージは読みましょうということです。。
brew doctor さんがしっかりしていて助かりました。