Updated to PHP 5.6, unable to connect to MySQL

I upgraded from PHP 5.3 to 5.6 to take advantage of the 2GB upload feature in 5.6. Thus the following line dies

:

$db = ($GLOBALS["___mysqli_ston"] = mysqli_connect($dbhost,  $dbuser, $dbpass))
    or die("The site database appears to be down.");

      

Log message:

mysqli_connect(): The server requested authentication method unknown to the client

      

How about upgrading to PHP 5.6 will cause this line to fail?

+3


source to share


1 answer


The problem has been resolved. MySQL was updated at the same time as PHP. The old MySQL version used the old password style, which did not work with the newer PHP version.

The solution was to log into MySQL on the server and reset the passwords from the old 16 character hashes to the new ~ 40 character hashes.



SET PASSWORD FOR 'someuser'@'localhost' = PASSWORD('somepassword');
FLUSH PRIVILEGES;

      

Once this has been done, the site is up and running again.

+2


source







All Articles