1

Database creation fails with Authentication plugin 'caching_sha2_password' cannot be loaded error.

Above error occurs when I run following command:

$ RAILS_ENV=test rake db:create

Error message:

Authentication plugin 'caching_sha2_password' cannot be loaded: dlopen(/usr/local/Cellar/mysql@5.6/5.6.46/lib/plugin/caching_sha2_password.so, 2): image not found
Couldn't create database for {"adapter"=>"mysql2", "encoding"=>"utf8", "reconnect"=>true, "pool"=>5, "socket"=>"/tmp/mysql.sock", "username"=>"root", "password"=>nil, "database"=>"ht_test"}, charset: utf8, collation: utf8_unicode_ci
(if you set the charset manually, make sure you have a matching collation)

I know other developers had similar issues with mysql@8.* . Thats why I switched to mysql@5.6 . Still I am facing this issue.

Please suggest possible solutions.

Thanks

nightfury
  • 55
  • 2
  • 7
  • Did you try this https://stackoverflow.com/questions/49194719/authentication-plugin-caching-sha2-password-cannot-be-loaded? – akbarbin Oct 24 '19 at 02:49
  • 1
    Possible duplicate of [Authentication plugin 'caching\_sha2\_password' cannot be loaded](https://stackoverflow.com/questions/49194719/authentication-plugin-caching-sha2-password-cannot-be-loaded) – Aguardientico Oct 24 '19 at 02:49

1 Answers1

1

try using this, it worked for me

ALTER USER 'yourusername'@'localhost' 
IDENTIFIED WITH mysql_native_password BY 'youpassword';
L_J
  • 2,351
  • 10
  • 23
  • 28