スポンサーリンク
  • MySQL8.0以降、認証プラグインは「caching_sha2_password」がデフォルト
  • PHPなど未対応の言語でエラーが発生(SQLSTATE[HY000] [2054] The server requested authentication method unknownto the client)

対応方法として、ネイティブ認証プラグインを使用するように対応を行う。

ユーザー作成

ネイティブ認証プラグイン「mysql_native_password」でログインができるユーザの作成方法

-- caching_sha2_passwordを使用しないユーザーの作成
create user 'user'@'localhost' identified with mysql_native_password by 'password';
  • 'user'にはユーザー名
  • 'password'にはパスワード

関連記事

スポンサーリンク
レンタルサーバー
おすすめの記事