PHP 7.2.8 & MySQL 8.0


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 plugincaching_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 :

$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>";

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: &lt;br&gt;";
   echo "Query: " . $sql . "<br>";
   echo "Errno: " . $mysqli->errno . "<br>";
   echo "Error: " . $mysqli->error . "<br>";

$user = $result->fetch_assoc();
echo "user: " . $user['user'] . "<br>";
echo "plugin: " . $user['plugin'];


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 !

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

I deeply value the diversity of MySQL developers, users, community and my blog readers. I cannot agree the suffering, oppression, and systemic racism the Black community faces every day. Black lives matter.