skip to Main Content

Step 1) mysql5 & phpmyadmin

Image the following mysql-phpmyadmin configuration:

version: '3.6'

services:

  db:
    image: mysql:5.7.24
#    image: mysql:8.0.18
#    image: mariadb:10.4.8
#    command: --default-authentication-plugin=mysql_native_password
    restart: always
    volumes:
    - ./mysql5:/var/lib/mysql
#    - ./mysql8:/var/lib/mysql
#    - ./mariadb:/var/lib/mysql
    environment:
    - MYSQL_ROOT_PASSWORD=test
    - MYSQL_DATABASE=test
    - MYSQL_USER=test
    - MYSQL_PASSWORD=test

  phpmyadmin:
    image: phpmyadmin/phpmyadmin:4.8.5
    restart: always
    depends_on:
    - db
    environment:
    - PMA_HOST=db
    - PMA_PORT=3306
    - PMA_USER=test
    - PMA_PASSWORD=test
    ports:
    - "3333:80"

I can access my mysql-database via phpmyadmin: http://localhost:3333/

Step 2) mysql8 & phpmyadmin

Now I switch to mysql8, where I only the image and volume and added the command-option with the mysql_native_password-plugin:

version: '3.6'

services:

  db:
#    image: mysql:5.7.24
    image: mysql:8.0.18
#    image: mariadb:10.4.8
    command: --default-authentication-plugin=mysql_native_password
    restart: always
    volumes:
#    - ./mysql5:/var/lib/mysql
    - ./mysql8:/var/lib/mysql
#    - ./mariadb:/var/lib/mysql
    environment:
    - MYSQL_ROOT_PASSWORD=test
    - MYSQL_DATABASE=test
    - MYSQL_USER=test
    - MYSQL_PASSWORD=test

  phpmyadmin:
    image: phpmyadmin/phpmyadmin:4.8.5
    restart: always
    depends_on:
    - db
    environment:
    - PMA_HOST=db
    - PMA_PORT=3306
    - PMA_USER=test
    - PMA_PASSWORD=test
    ports:
    - "3333:80"

I can access my mysql-database via phpmyadmin: http://localhost:3333/

Step 3) mariadb & phpmyadmin

Now I switch to mariadb with the following configuration, where I only changed the image and volume:

version: '3.6'

services:

  db:
#    image: mysql:5.7.24
#    image: mysql:8.0.18
    image: mariadb:10.4.8
    command: --default-authentication-plugin=mysql_native_password
    restart: always
    volumes:
#    - ./mysql5:/var/lib/mysql
#    - ./mysql8:/var/lib/mysql
    - ./mariadb:/var/lib/mysql
    environment:
    - MYSQL_ROOT_PASSWORD=test
    - MYSQL_DATABASE=test
    - MYSQL_USER=test
    - MYSQL_PASSWORD=test

  phpmyadmin:
    image: phpmyadmin/phpmyadmin:4.8.5
    restart: always
    depends_on:
    - db
    environment:
    - PMA_HOST=db
    - PMA_PORT=3306
    - PMA_USER=test
    - PMA_PASSWORD=test
    ports:
    - "3333:80"

Now I cannot access my mariadb-database via phpmyadmin:

enter image description here

Following the mariadb-README on docker hub, the environment configuration should be the same as for the mysql5-container. I assume, that I also need to enable the mysql_native_password, which does not work as for the mysql8-container.

What do I miss? Is this a bug or do I miss something?

3

Answers


  1. Chosen as BEST ANSWER

    It works for mariadb with --default-authentication-plugin=mysql_native_password, just the container start is really slow.

    [Edit] Here is a MWE, which works with different mysql-versions (5 and 8) and the newest mariadb (10):


  2. Your docker-compose file works. I start MySQL container than switch to MariaDB image and it’s working fine. I think you should look into docker logs. The answer is there

    Login or Signup to reply.
  3. MariaDB doesn’t have default-authentication-plugin option. That might be the reason

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search