内容へ移動
ゆーものメモ帳
ユーザ用ツール
管理
ログイン
サイト用ツール
検索
ツール
文書の表示
以前のリビジョン
バックリンク
最近の変更
メディアマネージャー
サイトマップ
ログイン
>
最近の変更
メディアマネージャー
サイトマップ
トレース:
プログラム言語:php:laravel:the_server_requested_authentication_method_unknown_to_the_client_と出るとき
この文書は読取専用です。文書のソースを閲覧することは可能ですが、変更はできません。もし変更したい場合は管理者に連絡してください。
====== 【Laravel】The server requested authentication method unknown to the client と出るとき ====== MySQL8 からデフォルトのログイン認証方式が caching_sha2_password になりました。\\ しかし、PDO ではこの認証方式がサポートされていないため以下のエラーがでる。 <code>The server requested authentication method unknown to the client</code> 対処法は、MySQLにログインして認証方式を mysql_native_password に変更するだけ。 <code> # 現在の設定を確認 select user, host, plugin from mysql.user; +----------+-----------+-----------------------+ | user | host | plugin | +----------+-----------+-----------------------+ | hogefuga | localhost | caching_sha2_password | +----------+-----------+-----------------------+ # 設定変更 alter user hogefuga@localhost identified with mysql_native_password by 'パスワード'; # 変更されたか確認 select user, host, plugin from mysql.user; +----------+-----------+-----------------------+ | user | host | plugin | +----------+-----------+-----------------------+ | hogefuga | localhost | mysql_native_password | +----------+-----------+-----------------------+ </code> ちなみに上記方法では、新規 MySQL ユーザを作成すると毎回同じ現象に遭遇することになるのでデフォルトの認証方式を mysql_native_password に変更してしまう方法もある。 <code> vi /etc/my.cnf [mysqld] default-authentication-plugin=mysql_native_password # 再起動 sudo service mysqld restart </code>
プログラム言語/php/laravel/the_server_requested_authentication_method_unknown_to_the_client_と出るとき.txt
· 最終更新: 2020/03/11 16:03 by
humolife
ページ用ツール
文書の表示
以前のリビジョン
バックリンク
文書の先頭へ