ERROR 1045 (28000): Plugin caching_sha2_password could not be loaded

When I try to connect to a MySQL 8 server, I get the following error

root@ok:~# mysql -u serverok -p'PW_HERE' -h db-mysqlserverok.in -P 3306
ERROR 1045 (28000): Plugin caching_sha2_password could not be loaded: /usr/lib/x86_64-linux-gnu/mariadb19/plugin/caching_sha2_password.so: cannot open shared object file: No such file or directory
root@ok:~#

This is because of MySQL 8 use more secure authentication. This is not supported by your MySQL installation. What you can do is connect using MySQL 8 client or change the authentication method to use old authentication.

To create a user with the old authentication method, use the following SQL commands

Advertisement

CREATE USER 'admin'@'localhost' IDENTIFIED WITH mysql_native_password BY 'PASSWORD_HERE';
GRANT ALL PRIVILEGES ON *.* TO 'admin'@'localhost';
FLUSH PRIVILEGES;

To change a user to use mysql_native_password, run

ALTER USER ‘username’@’localhost’ IDENTIFIED WITH ‘mysql_native_password’ BY ‘PASSWORD_HERE’;

if you need to set this server wide, edit my.cnf and add

[mysqld]
default_authentication_plugin=mysql_native_password
Add a comment

Leave a Reply

Your email address will not be published. Required fields are marked *

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Advertisement