Lando: Set better defaults for mysql 8 auth plugin

Created on 6 Apr 2020  路  3Comments  路  Source: lando/lando

System: Mac OSX - Mojave 10.14.6
Docker Desktop: 2.2.0.4
Lando: v3.0.0-rrc.2

I'm using the Drupal 8 recipe with MySQL 8:

name: example
recipe: drupal8
config:
  webroot: web
  php: '7.3'
  via: nginx
  database: mysql:8.0
  drush: "*"
  xdebug: false

I'm having issues connecting to MySQL. For example, trying to install a site with lando drush site:install --existing-config --yes I get the following error:

 [warning] Failed to drop or create the database. Do it yourself before installing. ERROR 2059 (HY000): Authentication plugin 'caching_sha2_password' cannot be loaded: /usr/lib/x86_64-linux-gnu/mariadb18/plugin/caching_sha2_password.so: cannot open shared object file: No such file or directory

It seems that MySQL 8 changed the default auth plugin to "caching_sha2_password", so maybe a solution is to set "MYSQL_AUTHENTICATION_PLUGIN" to "mysql_native_password" like this bitnami example?

bug

All 3 comments

I seemed to be able to get around this by updating my landoFile:

name: example
recipe: drupal8
config:
  webroot: web
  php: '7.3'
  via: nginx
  drush: "*"
  xdebug: false
services:
  database:
    type: mysql:8.0
    config:
      database: etc/config/mysql.cnf

and adding a custom configuration at etc/config/mysql.cnf that looks like this:

[mysqld]
max_allowed_packet=32M
default-authentication-plugin=mysql_native_password

@ericpugh we actually use that bitnami image under the hood so should be pretty easy to implement this. I'm going to increase the scope of this issue so its generic to the mysql:8 service. I think what we want to do is

  • Have the authentication plugin be configurable
  • Set a sane default for this given the context eg use mysql_native_password for Drupal/WordPress etc.

Alright @ericpugh this will be fixed in the next edge release! Even updated our Drupal 8 test to verify this.
https://github.com/lando/lando/tree/master/examples/drupal8

Was this page helpful?
0 / 5 - 0 ratings