When I tried upgrading from PHP 7.3 to PHP 7.4, I received this error:
Unexpected server response while doing caching_sha2 auth 109
As I see it, this indicates that PHP 7.4 MySQLi is trying to use the caching_sha2_password
plugin. This article points out that PHP MySQLi does not support the plugin (it also hints future support for it), but since PHP 7.4 is new and seems to be trying to use it, I guess it should work. Also the error message is different, than if it wasn't supported (access denied vs. authentication method unknown).
So I changed my MySQL authentication plugin to caching_sha2_password
(using the same password as before):
ALTER USER 'root'@'localhost' IDENTIFIED WITH caching_sha2_password BY '';
FLUSH PRIVILEGES;
But this caused another error:
Access denied for user 'root'@'localhost' (using password: YES).
Switching back to PHP 7.3 and mysql_native_password
it works again.
I used the same password for both plugins, the same website and applied the same php.ini changes.
I however did not change any mysqli
configuration. The logs for MySQL show nothing, the apache2 log only shows the 'Access Denied' error message.
Does php7.4-mysqli have support for caching_sha2_password
? YES
Why is my password being denied and how can I fix it? See my follow-up question
Also, if MySQLi still doesn't support the plugin: How can I use mysql_native_password
with it?