LoginSignup
5
2

More than 3 years have passed since last update.

CircleCI MySQL8.0 認証方式の変更

Last updated at Posted at 2020-01-10

CircleCIの設定でLaravelのマイグレーションが上手くいかずにハマりました、、、

環境

mysql ver 8.0

エラー

マイグレーションStep時にエラーになります

#!/bin/bash -eo pipefail
php artisan migrate

In Connection.php line 669:

  SQLSTATE[HY000] [2054] The server requested authentication method unknown t  
  o the client (SQL: select * from information_schema.tables where table_sche  
  ma = circle_test and table_name = migrations and table_type = 'BASE TABLE')  


In Connector.php line 70:

  SQLSTATE[HY000] [2054] The server requested authentication method unknown t  
  o the client                                                                 


In Connector.php line 70:

  PDO::__construct(): The server requested authentication method unknown to t  
  he client [caching_sha2_password]                                            



Exited with code exit status 1

原因

MySQL8.0.4 デフォルトの認証方式変更

MySQL8.0.4以降のログイン認証方式はcaching_sha2_passwordがデフォルトであり、
接続ライブラリがcaching_sha2_passwordに未対応のため接続不可

参考: MySQL8.0 認証方式を変更する(Laravel5)

解決策

.circleci/config.ymlcommand: [--default-authentication-plugin=mysql_native_password]追記

.circleci/config.yml
docker:
  - image: circleci/mysql:8.0
    command: [--default-authentication-plugin=mysql_native_password]
5
2
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
5
2