Требования

Чтобы эти функции были доступны, PHP должен быть собран с поддержкой расширения mysqli.

MySQL 8

При запуске PHP до версии 7.1.16 или PHP 7.2 до 7.2.4, установите плагин по умолчанию MySQL 8 Server в mysql_native_password, иначе вы увидите ошибки, похожие на The server requested authentication method unknown to the client [caching_sha2_password], даже когда caching_sha2_password не используется.

Это связано с тем, что MySQL 8 по умолчанию использует caching_sha2_password, и плагин не распознается старыми версиями PHP (mysqlnd). Вместо этого измените это, установив default_authentication_plugin=mysql_native_password в my.cnf. Плагин caching_sha2_password будет поддерживаться в будущей версии PHP. Пока же расширение mysql_xdevapi поддерживает его.

add a note add a note

User Contributed Notes 2 notes

up
-7
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
-49
alvaro at demogracia dot com
5 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