Requisiti

In order to have these functions available, you must compile PHP with support for the mysqli extension.

MySQL 8

When running a PHP version before 7.1.16, or PHP 7.2 before 7.2.4, set MySQL 8 Server's default password plugin to mysql_native_password or else you will see errors similar to The server requested authentication method unknown to the client [caching_sha2_password] even when caching_sha2_password is not used.

This is because MySQL 8 defaults to caching_sha2_password, a plugin that is not recognized by the older PHP (mysqlnd) releases. Instead, change it by setting default_authentication_plugin=mysql_native_password in my.cnf. The caching_sha2_password plugin is fully supported as of PHP 7.4.4. For older releases, the mysql_xdevapi extension does support it.

add a note add a note

User Contributed Notes 2 notes

up
-22
james at jmwhite dot co dot uk
3 years ago
PHP 7.4 now supports MySQL with caching_sha2_password, although it is a bit unclear around older versions, there seems to be conflicting reports. What is the support of caching_sha2_password in PHP < 7.4?
up
-59
alvaro at demogracia dot com
6 years ago
Supported authentication methods are listed in the "Loaded plugins" row of the "mysqlnd" section in phpinfo(). Look for plugins that start with "auth_plugin_…".
To Top