When connecting to MySQL I get an authentication error

ER_NOT_SUPPORTED_AUTH_MODE: Client does not support authentication protocol requested by server; consider upgrading MySQL client
Authentication plugin 'caching_sha2_password' cannot be loaded: /usr/lib64/mysql/plugin/caching_sha2_password.so: cannot open shared object file: No such file or directory

Authentication errors occur when you attempt to connect to MySQL using an application like MySQL Workbench or a version 5.x client that does not support the caching_sha2_password.

If you are getting one of these errors using a PHP-based application to connect to the database, the following solution only works for applications using PHP 7.2 or higher. Set the user’s password encryption settings to MySQL 5.x encryption settings, using the Password Encryption option in the control panel.

Otherwise, you can use the following solution to connect to MySQL with a 5.x client or an application that does not support caching_sha2_password. Connect using MySQL 8.x and issue the following statement, which changes the password type the server will accept for the current user. Replace use_your_user with your MySQL username, and replace use_your_password with the user’s current password:

    
        
            
ALTER USER use_your_user IDENTIFIED WITH mysql_native_password BY 'your_password';

        
    
Note
DigitalOcean Managed Databases using MySQL 8+ are automatically configured to use caching_sha2_password authentication by default. caching_sha2_password uses a stronger password encryption than prior versions of MySQL and PHP based applications using PHP 7.1 or older do not support MySQL 8+ password encryption.