|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2012-01-23 01:00 UTC] FM_Silver at gmx dot de
Description:
------------
Using mysql 5.5.19, loaded auth_socket plugin and created a user to auth with it:
mysql> INSTALL PLUGIN auth_socket SONAME 'auth_socket.so';
mysql> CREATE USER 'someuser'@'localhost' IDENTIFIED WITH auth_socket;
Also assume an existing database 'website'.
Trying to auth with user someuser works, when using the mysql client, but fails with mysqlnd as shown below.
Test script:
---------------
<?php
$mysqli = new mysqli("localhost", "someuser", "", "website");
if (mysqli_connect_errno()) {
printf("Connect failed: %s\n", mysqli_connect_error());
exit();
}
printf("Host information: %s\n", $mysqli->host_info);
$mysqli->close();
?>
Expected result:
----------------
Host information: Localhost via UNIX socket
Actual result:
--------------
PHP Warning: mysqli::mysqli(): (08004/1251): Client does not support authentication protocol requested by server; consider upgrading MySQL client in /home/someuser/mysql.php on line 2
PHP Stack trace:
PHP 1. {main}() /home/someuser/mysql.php:0
PHP 2. mysqli->mysqli() /home/someuser/mysql.php:2
Connect failed: Client does not support authentication protocol requested by server; consider upgrading MySQL client
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Nov 01 13:00:01 2025 UTC |
Pluggable authentication support was added to PHP 5.4. The auth_socket plugin works there: mysql> CREATE USER 'johannes'@'localhost' IDENTIFIED WITH auth_socket; mysql> exit $ whoami johannes $ php54 -r '$mysqli = new mysqli("localhost", "johannes", "", "test", 0, "/tmp/mysql55.sock"); echo $mysqli->query("show grants")->fetch_row()[0];' GRANT USAGE ON *.* TO 'johannes'@'localhost'