MySQL 8.0.17 and Drupal 8.7

From Drupal’s website, we can see that now the support of MySQL 8 is ready.

I just tested it and it works great !

The only restriction is related to PHP and the support for the new authentication method in php-mysqlnd.

In this previous post, I was happy because it was included in PHP 7.2.8, but this has been reverted back since then. Currently none of the latest version of PHP 7.x is supporting this authentication method.

We can easily verify this, first with the PHP version provided by default in Oracle Linux 8:

# php -i | grep "Loaded plugins\|PHP Version " | tail -n2
PHP Version => 7.2.11
Loaded plugins => mysqlnd,debug_trace,auth_plugin_mysql_native_password,
                  auth_plugin_mysql_clear_password,auth_plugin_sha256_password

And it’s the same with the PHP versions available in Remi’s repositories:

# php71 -i | grep "Loaded plugins\|PHP Version " | tail -n2
PHP Version => 7.1.30
Loaded plugins => mysqlnd,debug_trace,auth_plugin_mysql_native_password,
                  auth_plugin_mysql_clear_password,auth_plugin_sha256_password
# php72 -i | grep "Loaded plugins\|PHP Version " | tail -n2
PHP Version => 7.2.20
Loaded plugins => mysqlnd,debug_trace,auth_plugin_mysql_native_password,
                  auth_plugin_mysql_clear_password,auth_plugin_sha256_password
# php73 -i | grep "Loaded plugins\|PHP Version " | tail -n2
PHP Version => 7.3.7
Loaded plugins => mysqlnd,debug_trace,auth_plugin_mysql_native_password,
                  auth_plugin_mysql_clear_password,auth_plugin_sha256_password

In comparison, with PHP 7.2.9, and PHP 7.2.10 we could see this:

# php -i | grep "Loaded plugins\|PHP Version " | tail -n2
PHP Version => 7.2.9
Loaded plugins => mysqlnd,debug_trace,auth_plugin_mysql_native_password,
                  auth_plugin_mysql_clear_password,
                  auth_plugin_caching_sha2_password,auth_plugin_sha256_password

# php -i | grep "Loaded plugins|PHP Version " | tail -n2
PHP Version => 7.2.10
Loaded plugins => mysqlnd,debug_trace,auth_plugin_mysql_native_password,
                  auth_plugin_mysql_clear_password,
                  auth_plugin_caching_sha2_password,auth_plugin_sha256_password

You can note that auth_plugin_caching_sha2_passwordis present. It has been removed since PHP 7.2.11. (I was not able to find anything in the release notes)

This means that if you are using MySQL 8.0 and Drupal 8.7 with the lastest PHP, you just need to make sure to not forgot when you create the user used by drupal to connect to your database to specify the authentication method like this:

mysql> create user drupal_web identified with 'mysql_native_password' by 'password';

Conclusion

So, yes, kudos to the Drupal team to support MySQL 8.0 ! No patch or change needed anymore (like it was before, see this post).

Unfortunately, PHP mysqlnd doesn’t support yet caching_sha2_password. You can follow the discussions about this in the links below:

Subscribe to Blog via Email

Enter your email address to subscribe to this blog and receive notifications of new posts by email.

One comment

  1. I had bookmarked this web page on my laptop earlier at the hotel at OOW19 and then I decided to attend a session titled “Looking inside MySQL Datastore” and low and behold there your name was on the big screen. Enjoyed your talk and excited about where MySQL is going and especially the pointers on getting Drupal 8 talking to MySQL 8. Thanks!

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.

As MySQL Community Manager, I am an employee of Oracle and the views expressed on this blog are my own and do not necessarily reflect the views of Oracle.

You can find articles I wrote on Oracle’s blog.