内容へ移動
ゆーものメモ帳
ユーザ用ツール
管理
ログイン
サイト用ツール
検索
ツール
文書の表示
以前のリビジョン
バックリンク
最近の変更
メディアマネージャー
サイトマップ
ログイン
>
最近の変更
メディアマネージャー
サイトマップ
トレース:
ソフトウェア:docker:トラブルシューティング:laravel_の_php_artisan_migrate_で_the_server_requested_authentication_method_unknown_to_the_client_と出るとき
この文書は読取専用です。文書のソースを閲覧することは可能ですが、変更はできません。もし変更したい場合は管理者に連絡してください。
====== Laravel の php artisan migrate で The server requested authentication method unknown to the client と出るとき ====== Docker に限った話ではないのですが、マイグレーションをしようとした際に以下のエラーがでました。 <code> $ php artisan migrate Illuminate\Database\QueryException : SQLSTATE[HY000] [2054] The server requested authentication method unknown to the client (SQL: select * from information_schema.tables where table_schema = laravel_db and table_name = migrations and table_type = 'BASE TABLE') at /var/www/production/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 Doctrine\DBAL\Driver\PDOException::("SQLSTATE[HY000] [2054] The server requested authentication method unknown to the client") /var/www/production/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOConnection.php:31 2 PDOException::("PDO::__construct(): The server requested authentication method unknown to the client [caching_sha2_password]") /var/www/production/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOConnection.php:27 Please use the argument -v to see more details. </code> 原因は、MySQL8.0から認証プラグインが caching_sha2_password に変更されたけれど、Laravel 側が対応していないためエラーが表示されるとのこと。 そこで、my.cnf に認証プラグインを mysql_native_password にするように記載し、Dockerfile で DBコンテナにコピーするようにする。 <code> # ディレクトリは適時移動 $ vim conf.d/my.cnf [mysqld] default_authentication_plugin= mysql_native_password $ vim Dockerfile FROM mysql:latest COPY ./conf.d /etc/mysql/conf.d </code> これで、コンテナを一度削除し、起動し直すと、マイグレーションに成功するはずです。
ソフトウェア/docker/トラブルシューティング/laravel_の_php_artisan_migrate_で_the_server_requested_authentication_method_unknown_to_the_client_と出るとき.txt
· 最終更新: 2019/08/09 15:47 by
yusuke_komori
ページ用ツール
文書の表示
以前のリビジョン
バックリンク
文書の先頭へ