LoginSignup
0
1

More than 3 years have passed since last update.

laravelのmigrateができなかったときのメモ

Posted at

SQLSTATE[HY000] [2054] The server requested authentication method unknown to the clientみたいなエラーを解決できたのでそのメモ。

とりあえずマイグレーションさえしてくれればよかったのでrootで動かしてみました。

mysql> select User, Host, plugin from mysql.user;
+------------------+-----------+-----------------------+
| User             | Host      | plugin                |
+------------------+-----------+-----------------------+
| mysql.infoschema | localhost | caching_sha2_password |
| mysql.session    | localhost | caching_sha2_password |
| mysql.sys        | localhost | caching_sha2_password |
| root             | localhost | caching_sha2_password |
+------------------+-----------+-----------------------+

rootユーザーの認証方式をcaching_sha2_passwordからmysql_native_passwordへ変更したらマイグレーションできました。

alter user root@localhost identified with mysql_native_password by "secret";
mysql> select User, Host, plugin from mysql.user;
+------------------+-----------+-----------------------+
| User             | Host      | plugin                |
+------------------+-----------+-----------------------+
| mysql.infoschema | localhost | caching_sha2_password |
| mysql.session    | localhost | caching_sha2_password |
| mysql.sys        | localhost | caching_sha2_password |
| root             | localhost | mysql_native_password |
+------------------+-----------+-----------------------+
0
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
1