https://teratail.com/questions/113704?nli=5a8e3130-b434-41bb-ae57-32410a180132
こちらに質問させていただきました結果、私のやり方だとmysqlがrootパスワード無しでインストールされるはずのようです。
確かに、
$ brew info mysql mysql: stable 5.7.21 (bottled), devel 8.0.4-rc Open source relational database management system https://dev.mysql.com/doc/refman/5.7/en/ Conflicts with: mariadb (because mysql, mariadb, and percona install the same binaries.) mariadb-connector-c (because both install plugins) mysql-cluster (because mysql, mariadb, and percona install the same binaries.) mysql-connector-c (because both install MySQL client libraries) percona-server (because mysql, mariadb, and percona install the same binaries.) /usr/local/Cellar/mysql/5.7.21 (323 files, 233.9MB) * Poured from bottle on 2018-03-10 at 13:31:46 From: https://github.com/Homebrew/homebrew-core/blob/master/Formula/mysql.rb ==> Dependencies Build: cmake ✘ Required: openssl ✔ ==> Requirements Required: macOS >= 10.7 ✔ ==> Options --with-debug Build with debug support --with-embedded Build the embedded server --with-local-infile Build with local infile loading support --with-memcached Build with InnoDB Memcached plugin --with-test Build with unit tests --devel Install development version 8.0.4-rc ==> Caveats We've installed your MySQL database without a root password. To secure it run: mysql_secure_installation MySQL is configured to only allow connections from localhost by default To connect run: mysql -uroot To have launchd start mysql now and restart at login: brew services start mysql Or, if you don't want/need a background service you can just run: mysql.server start
異常を見る限り
mysql -uroot
でログインできそうなんですが、
$ mysql -uroot ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
となってしまいます。
brew uninstall --ignore-dependencies mysql
でアンインストールしても全く同じ結果しか出てきません。
これは多分同じことしてるからだと思うのですが、どうすればいいのかもわからないため途方に暮れています。
ちなみに関係あるかわかりませんが、ここでPHPをインストールするまでは
$ brew doctor
しても大丈夫だったのが、文言が変わってしまいました。というか警告が出てしまっています。
$ brew doctor Please note that these warnings are just used to help the Homebrew maintainers with debugging if you file an issue. If everything you use Homebrew for is working fine: please don't worry or file an issue; just ignore this. Thanks! Warning: Homebrew's sbin was not found in your PATH but you have installed formulae that put executables in /usr/local/sbin. Consider setting the PATH for example like so echo 'export PATH="/usr/local/sbin:$PATH"' >> ~/.bash_profile
以下実施したmysqlのアンインストール手順です。
$ brew uninstall --ignore-dependencies mysql
この後
/usr/local/var/mysql
を削除しました。
以下実施したphpのアンインストール手順です。
$ rm -rf ~/.phpenv/versions/7.1.7 $ phpenv rehash $ brew unlink php71
最後にapacheも
$ brew uninstall httpd24
で消しました。