備忘録として残します。
訳あって、xamppではなくmampをWindowsに入れて開発環境を構築することになりました。
xamppと違って初期セットはかなり楽かなと思いきや、rootのパスワード無でログインしようとしたら下記のようにエラー。
C:\MAMP\bin\mysql\bin>mysql -u root -p
Enter password:
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
なんやかんや調べてみたらどうやらxamppと違いrootユーザにもパスワードがちゃんと設定されている(空でない)とのこと。
パスワードもまたroot
で設定されているようなので、改めてチャレンジ。
するとちゃんとログインできました。
C:\MAMP\bin\mysql\bin>mysql -u root -proot
Warning: Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 12
Server version: 5.6.34-log MySQL Community Server (GPL)
Copyright (c) 2000, 2016, 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>
調べてみるとrootに何も権限がないとか、いろいろ書かれていたが、phpmyadmin上でmysql.userのrootアカウントを見るとちゃんと全ての権限が付与されているため、ちょっと何言ってるかわからない状態になりました。
おまけにWindows版のMampの最新版4.1.0(2019/01/21現在)はPHP.iniを書き換えるとMysqlが次から起動できなくなるし、ほんとなんなんだ。