Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MySQL 8 support broken #117

Open
Synchro opened this issue Feb 3, 2021 · 3 comments · May be fixed by Synchro/gitlab-ci-pipeline-php#1 or #118
Open

MySQL 8 support broken #117

Synchro opened this issue Feb 3, 2021 · 3 comments · May be fixed by Synchro/gitlab-ci-pipeline-php#1 or #118

Comments

@Synchro
Copy link

Synchro commented Feb 3, 2021

The image uses mariadb-client instead of mysql-client. This means that anything trying to connect to MySQL 8.0 server will fail by default because the mariaDB client does not include support for the caching_sha2_password plugin. This is a fatal error that can't easily be fixed from outside because MariaDB does not support this authentication mechanism, so in a testing scenario like this, it is not an appropriate substitution. This is how it is configured in CI:

db-seeding:
  stage: build
  services:
    - mysql:8.0

and here's an example of how it fails in a pipeline:

The command "mysql --user="${:LARAVEL_LOAD_USER}" --password="${:LARAVEL_LOAD_PASSWORD}" --host="${:LARAVEL_LOAD_HOST}" --port="${:LARAVEL_LOAD_PORT}" --database="${:LARAVEL_LOAD_DATABASE}" < "${:LARAVEL_LOAD_PATH}"" failed.
Exit Code: 1(General error)
Working directory: /builds/myapp
Output:
================
Error Output:
================
ERROR 1045 (28000): Plugin caching_sha2_password could not be loaded: /usr/lib/x86_64-linux-gnu/mariadb19/plugin/caching_sha2_password.so: cannot open shared object file: No such file or directory

This was fixed once before in a PR, but that was never merged.

A possible workaround would be to manually install the mysql client package prior to running the pipeline, but that should not be something we need to do in a default config.

Synchro added a commit to Synchro/gitlab-ci-pipeline-php that referenced this issue Feb 3, 2021
The MariaDB client is not compatible with default configurations of MySQL server 8.0, so any PHP app using this config will break. This PR switches to mysql-client, which is generally compatible with MariaDB server as well. Fixes edbizarro#117
@Synchro Synchro linked a pull request Feb 3, 2021 that will close this issue
@edbizarro
Copy link
Owner

I remember back in the time that there's a reason to this change to mariadb-client, but was a long time ago and i don't remember why anymore, so, i think we can change back to mysql-client again and see

@Synchro
Copy link
Author

Synchro commented Feb 3, 2021

I found that reference. I checked, and it's correct – Debian buster does not provide a MySQL package (which I'm a bit surprised by). MySQL's policy on this is that they provide a repo for Debian packages that you should use instead. Unfortunately this implies a certain amount of inconvenience as per this guide, though the problem here is with the client; we don't need the server. I'll have a go at scripting that in my PR, which won't work in its current state.

Synchro added a commit to Synchro/gitlab-ci-pipeline-php that referenced this issue Feb 4, 2021
@Synchro Synchro linked a pull request Feb 4, 2021 that will close this issue
@Synchro
Copy link
Author

Synchro commented Mar 5, 2021

I have found a workaround for this. In the gitlab.ci.yml file, instead of saying:

services: mysql:8.0

say:

services:
    - name: mysql:8.0
      command: [ "--default-authentication-plugin=mysql_native_password" ]

which makes the client use old-style authentication. Bear in mind that this is very much a workaround as it involves a security downgrade.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants