A good news for all PHP CMS users like Drupal and Joomla!, PHP 7.2.8 (available on Remi’s repo for those using rpms) supports the new MySQL 8.0 default authentication plugin ‘caching_sha2_password
‘ !
So, I’ve installed PHP 7.2.8:
And I’ve my user (here joomla) uses the caching_sha2_password
:
I give acces those this user to SELECT in mysql.user table:
Now let’s share my wonderful PHP skills :
<!--?php $mysqli = new mysqli('localhost', 'joomla', 'joomla', 'joomla_db'); if ($mysqli->connect_errno) { echo "Sorry, this website is experiencing problems.<p>"; echo "Error: Failed to make a MySQL connection, here is why: <br>"; echo "Errno: " . $mysqli->connect_errno . "<br>"; echo "Error: " . $mysqli->connect_error . "<br>"; exit; } echo "Wooohoooo it works with PHP" . phpversion() ."!!<br><hr>"; $sql = "select user, plugin from mysql.user where user = 'joomla'"; if (!$result = $mysqli->query($sql)) { echo "Error: Our query failed to execute and here is why: <br>"; echo "Query: " . $sql . "<br>"; echo "Errno: " . $mysqli->errno . "<br>"; echo "Error: " . $mysqli->error . "<br>"; exit; } $user = $result->fetch_assoc(); echo "user: " . $user['user'] . "<br>"; echo "plugin: " . $user['plugin']; $result->free(); $mysqli->close(); ?>
And here is the result:
In conclusion, it seems the PHP team is taking care of MySQL 8.0 support and when you check the release tags in the github commit, you can see that this is not only for PHP 7.2.8 ! Good job ! So, please upgrade to a PHP version supporting MySQL 8 !
[…] But as you should already know, not all versions support the latest default authentication method in MySQL 8.0: caching_sha2_password [1], [2], [3]. […]