1

As mentioned by others (Ref 1, Ref 2 and Ref 3) the current phpMyAdmin version (4.8.2) + MySQL 8.0.11 + PHP 7.2.8 doesn't work as expected.

The error happens when you try to open phpMyAdmin, where it shows an error message:

#2054 - The server requested authentication method unknown to the client
mysqli_real_connect(): The server requested authentication method unknown to the client [caching_sha2_password]
mysqli_real_connect(): (HY000/2054): The server requested authentication method unknown to the client

As stated in MySQL migration manual here, and described as the solution in Ref 2, you can correct this by executing the following mysql query inside docker:

ALTER USER root IDENTIFIED WITH mysql_native_password BY 'ROOTPASSWORD';

(In order to run this, I use docker exec -it CONTAINERID bash and execute mysql command)

And it works. The main problem is that I need to fire this query as soon as the container starts (the current method is manual and far from scalable). I assume it's possible in different ways:

  • By executing a PHP script that runs the query after everything has been setup (IMO this is unsafe )
  • By running the above command in a bash after everything has been setup

The first one is unsafe IMO as the mysql user must have high privileges, although there will be only the root user when this script runs. I haven't tested it yet.

The seconde one is the best IMO, but I can't figure it out how to implement using Dockerfile, as everything I type there runs BEFORE mysql and phpMyAdmin are installed. How could I achieve that?

My current Dockerfile can be seen here and the docker-compose.yml can be seen here.

1 Answers1

1

As a simple solution, you can build your custom mysql image and run the command there. Then mysql will start with this modification already in place.

Michael
  • 301
  • 3
  • 8
  • I see... But I still can't figure out how to do that. Will I change it in docker-compose.yml? Or Dockerfile? Could you provide any ref/link/tutorial on that? – Fernando Constantino Jul 26 '18 at 04:24