** Ruby on rails ** When developing, I want to set database to mysql 8.0, and when I execute rails db: migrate with database.yml set to mysql, ** error "Authentication plugin'caching_sha2_password' cannot I will share the solution when it becomes "be loaded" **.
--Development environment: Windows10 Home 64-bit operating system, x64-based processor --Rails version 5 series

Since mysql 8.0, the authentication method uses caching_sha2_password. However, Rails didn't support this.
** Change the authentication method of the target user from "caching_sha2_password" to "mysql_native_password". ** ** This time, user changes the root authentication method.
`mysql -u root -p``root` (password this time) and press Enter.`SELECT user, host, plugin FROM mysql.user;` and check it.
`ALTER USER username IDENTIFIED WITH mysql_native_password BY'password';`Confirm that the root authentication method has been changed with `SELECT user, host, plugin FROM mysql.user;`.

Exit mysql with `` `exit```
Execute the rails migrate command of the main subject with `` `rails db: migrate```.
Completed without error.

Recommended Posts