Symptoms
When visiting a website, you receive a database connection error, and one of the following warnings/errors (or similar) is logged:
# Warning: mysqli_real_connect(): The server requested authentication method unknown to the client [caching_sha2_password]
# [Warning] [MY-013360] [Server] Plugin mysql_native_password reported: ''mysql_native_password' is deprecated and will be removed in a future release. Please use caching_sha2_password instead'
Cause
This is caused by using an older version of PHP with MySQL 8+. Specifically, the password caching program used by default in MySQL 8.0 is not compatible with versions of PHP older than 7.4.
MySQL 8.4 has an upstream bug in which it always uses caching_sha2_password for the initial connection handshake regardless of the default authentication plugin:
Bug #118447 MySQL 8.4 always uses caching_sha2_password in the initial connection handshake
Resolution
Use alt-php (PHP Selector) if CloudLinux is in use:
ALT-PHP vs EA-PHP: What is the difference?
Otherwise, you will want to change the site's PHP version to 7.4 or newer.
Comments
0 comments
Article is closed for comments.