Now that current versions of MySQL are forcing users to authenticate with caching_sha2_password instead of mysql_native_driver, I wanted to get PDO to send passwords that way. I think the only way to do it is to make the connection over SSL. Setting up your web server and database server for SSL is way beyond the scope of this note, but after you do, remember that you will need to add an options array as the last argument in your PDO connection arguments. At a minimum, you will need to supply the server certificate. In a development environment with a self-signed server certificate, you will also want to bypass verification that your server certificate is 'real'. So your options array would look like this
$opts = [ PDO::MYSQL_ATTR_SSL_CA => $server_cert_file_path, PDO::MYSQL_ATTR_SSL_VERIFY_SERVER_CERT => false];
Hope it helps!