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
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
See MySQL