RubyOnRails, Authentication plugin'caching_sha2_password' cannot be loaded error solution

RubyOnRails, Authentication plugin'caching_sha2_password' cannot be loaded error solution

** 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" **.

Organize the environment

--Development environment: Windows10 Home 64-bit operating system, x64-based processor --Rails version 5 series

Cause

Since mysql 8.0, the authentication method uses caching_sha2_password. However, Rails didn't support this.

Method

** Change the authentication method of the target user from "caching_sha2_password" to "mysql_native_password". ** ** This time, user changes the root authentication method.

  1. Access mysql with `mysql -u root -p`
  2. Enter `root` (password this time) and press Enter.
  3. Display the user list with `SELECT user, host, plugin FROM mysql.user;` and check it.
  1. Execute ``` ALTER USER root IDENTIFIED WITH mysql_native_password BY'root';` ``.
  1. Confirm that the root authentication method has been changed with `SELECT user, host, plugin FROM mysql.user;`. 222.png

  2. Exit mysql with `` `exit```

  3. Execute the rails migrate command of the main subject with `` `rails db: migrate```.

  4. Completed without error. 333.png

Recommended Posts

RubyOnRails, Authentication plugin'caching_sha2_password' cannot be loaded error solution
Spring-security error message cannot be changed
Rails error messages cannot be translated into Japanese
[Solution] Java cannot be installed on Windows 10 + ATOK 2017
[Android] Solution when the camera cannot be started on Android 9
Error: Main class not found or could not be loaded