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

Wordpress latest does not works with mysql latest container #313

Closed
shubhamrajvanshi opened this issue Jun 27, 2018 · 8 comments

Comments

Projects
None yet
4 participants
@shubhamrajvanshi
Copy link

commented Jun 27, 2018

Wordpress latest does not works with mysql latest container.
I get below error in wordpress container logs.

Warning: mysqli::__construct(): (HY000/2054): The server requested authentication method unknown to the client in Standard input code on line 22

MySQL Connection Error: (2054) The server requested authentication method unknown to the client

MySQL Connection Error: (2054) The server requested authentication method unknown to the client

Warning: mysqli::__construct(): The server requested authentication method unknown to the client [caching_sha2_password] in Standard input code on line 22

@wglambert

This comment has been minimized.

Copy link

commented Jun 27, 2018

MySQL 8 changed the password authentication method. You're looking for the mysql_native_password plugin
https://dev.mysql.com/doc/refman/8.0/en/native-pluggable-authentication.html

So you'll want to connect with mysql --default-auth=mysql_native_password -p

Or you could use mysql 5.7

docker-library/mysql#424 (comment)

@wglambert wglambert added the question label Jun 27, 2018

@shubhamrajvanshi

This comment has been minimized.

Copy link
Author

commented Jun 27, 2018

Thanks @wglambert but how do I add this to my mysql image. I need to use public image and not self build one's

@yosifkit

This comment has been minimized.

Copy link
Member

commented Jun 27, 2018

You just add it to the command (after the image on a docker run). Here is a docker compose:

version: '3.1'

services:

  wordpress:
    image: wordpress
    restart: always
    ports:
      - 8080:80
    environment:
      WORDPRESS_DB_PASSWORD: example

  mysql:
    image: mysql:5.7
# or
    image: mysql:8
    command: '--default-authentication-plugin=mysql_native_password'
# common options
    restart: always
    environment:
      MYSQL_ROOT_PASSWORD: example
@tianon

This comment has been minimized.

Copy link
Member

commented Jun 27, 2018

(Closing, since this is an issue with usage, not with the image. In the future, these sorts of questions/requests would be more appropriately posted to the Docker Community Forums, the Docker Community Slack, or Stack Overflow.)

@tianon tianon closed this Jun 27, 2018

@shubhamrajvanshi

This comment has been minimized.

Copy link
Author

commented Jun 28, 2018

@yosifkit I am not sure if I am right in here but wouldn't the command option fail in this case as it would override the original command in the image. I do see it's in quotes but wouldn't it become the command that was passed to it.

@shubhamrajvanshi

This comment has been minimized.

Copy link
Author

commented Jun 28, 2018

@tianon The reason I opened it as an issue so as to address it in wordpress rather than passing an extra argument. I was hoping to have a more general solution in the wordpress image itself rather than disabling a nice security feature in mysql. Thoughts?

@tianon

This comment has been minimized.

Copy link
Member

commented Jun 28, 2018

@yosifkit

This comment has been minimized.

Copy link
Member

commented Jul 3, 2018

@shubhamrajvanshi it shouldn't fail, since we are not overriding the entrypoint. The command becomes the arguments to the entrypoint and when the entrypoint gets arguments that are only flags (-*) it assumes they are flags for mysqld and eventually launches it with those provided flags.

https://github.com/docker-library/mysql/blob/fc3e856313423dc2d6a8d74cfd6b678582090fc7/8.0/docker-entrypoint.sh#L6-L8

Which is why these work:

$ docker run -it --rm mysql:8 --version
/usr/sbin/mysqld  Ver 8.0.11 for Linux on x86_64 (MySQL Community Server - GPL)
$ docker run -it --rm mysql:8 --verbose --help --default-authentication-plugin=mysql_native_password | grep default-authentication-plugin
  --default-authentication-plugin=name 
default-authentication-plugin                                mysql_native_password

dkrm0 added a commit to dkrm0/docker-1 that referenced this issue Apr 16, 2019

12: fix authentication method
La méthode de connexion à partir de MySQL 8 change par défaut.
La version de PHP la plus récente ne supporte pas cette méthode
il faut donc indiquer au serveur mysql que l'on souhaite supporter
l'ancienne méthode de connexion.

Explication:
- docker-library/wordpress#313

/!\ Attention
Changer les paramètres de connexion du serveur demande une suppression
du volume associé au serveur.

Merci Morgane

@verzola verzola referenced this issue May 14, 2019

Closed

update mysql to 8 #2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.