現在、Laravelの勉強を進めている初心者です。
この度、下記サイトのLaravel Tutorialを進めています。
https://www.inet-solutions.jp/technology/laravel-tutorial/
環境はMAMP5.1、MySQL5.7、Laravel5.7.3です。
進めていく中でartisanコマンドを打つと下記のようなエラーが発生しました。
Illuminate\Database\QueryException : SQLSTATE[HY000] [2054] The server requested authentication method unknown to the client (SQL: select * from information_schema.tables where table_schema = blog and table_name = migrations) at /Applications/MAMP/htdocs/blog/vendor/laravel/framework/src/Illuminate/Database/Connection.php:664 660| // If an exception occurs when attempting to run a query, we'll format the error 661| // message to include the bindings with SQL, which will make this exception a 662| // lot more helpful to the developer instead of just the database's errors. 663| catch (Exception $e) { > 664| throw new QueryException( 665| $query, $this->prepareBindings($bindings), $e 666| ); 667| } 668| Exception trace: 1 PDOException::("PDO::__construct(): The server requested authentication method unknown to the client [caching_sha2_password]") /Applications/MAMP/htdocs/blog/vendor/laravel/framework/src/Illuminate/Database/Connectors/Connector.php:68 2 PDO::__construct("mysql:host=127.0.0.1;port=3306;dbname=blog", "root", "root", []) /Applications/MAMP/htdocs/blog/vendor/laravel/framework/src/Illuminate/Database/Connectors/Connector.php:68
上記エラーで調べてみるといくつかの検索結果がヒットしています。
https://github.com/laradock/laradock/issues/1392
https://qiita.com/hondy12345/items/60a91488648f5ff45ff9
こちらの方法を見ていると my.cnf
に default_authentication_plugin=mysql_native_password
の記述を加えてあげるといいというものですが、デフォルトでは my.cnf
は作成されないため、どこからかコピーを取ってこなければならないと判断しています。
しかし、MAMPにも my.cnf
のコピーが見当たらず、どのようにすれば my.cnf
を作成し、上記のエラーが解決できるのかわからない状況です。
そこで質問したいのですが、
・解決方法として上記の方法で合っているでしょうか。
・my.cnf
をどのようにして作成すればよろしいのでしょうか。
・その他バージョンを下げるなどで対応が可能であればご教授お願いします。
以上、お手数ではありますが、よろしくお願いいたします。
回答2件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。