docker-library / mysql

Docker Official Image packaging for MySQL Community Server
https://dev.mysql.com/
GNU General Public License v2.0
2.47k stars 2.2k forks source link

no access as root user #1011

Closed ehbstudentadam closed 1 year ago

ehbstudentadam commented 1 year ago

Deleting container, images, volumes and doing a docker compose up does not help

My PhpMyadmin:

image

An hour ago I could access my root account without password. Now nothing.

image

Found this issue but now I can not even edit config file: https://github.com/docker-library/mysql/issues/275

docker-compose.yml file:

version: "3.8"

services:
  mysqldb:
    container_name : database_mysql
    image: mysql:8.2.0
    restart: unless-stopped
    env_file: ./.env
    environment:
      - MYSQL_ROOT_PASSWORD= ${MYSQLDB_ROOT_PASSWORD}
      - MYSQL_DATABASE= ${MYSQLDB_DATABASE}
    ports:
      - ${MYSQLDB_LOCAL_PORT}:${MYSQLDB_DOCKER_PORT}
    volumes:
      - petstoredb:/var/lib/mysql

  app:
    container_name : petstore_java
    depends_on:
      - mysqldb
    build: ./petstore
    restart: on-failure
    env_file: ./.env
    ports:
      - ${SPRING_LOCAL_PORT}:${SPRING_DOCKER_PORT}
    environment:
      SPRING_APPLICATION_JSON: '{ 
        "spring.datasource.url"  : "jdbc:mysql://mysqldb:${MYSQLDB_DOCKER_PORT}/${MYSQLDB_DATABASE}", 
        "spring.datasource.username" : "${MYSQLDB_USER}", 
        "spring.datasource.password" : "${MYSQLDB_ROOT_PASSWORD}",
        "spring.jpa.hibernate.ddl-auto" : "update", 
        "spring.security.oauth2.client.registration.google.client-id" : "${GOOGLE_OAUTH2_ID}", 
        "spring.security.oauth2.client.registration.google.client-secret" : "${GOOGLE_OAUTH2_SECRET}",
        "spring.jpa.properties.hibernate.dialect" : "org.hibernate.dialect.MySQL8Dialect" }'
    volumes:
      - .m2:/root/.m2
    stdin_open: true
    tty: true

  phpmyadmin:
    container_name: phpmyadmin
    image: phpmyadmin/phpmyadmin
    depends_on:
      - mysqldb
    ports:
      - ${PHPMYADMIN_LOCAL_PORT}:${PHPMYADMIN_DOCKER_PORT}
    environment:
      - PMA_HOST=mysqldb

volumes:
  petstoredb:
image

image

ehbstudentadam commented 1 year ago

removed space and added a line in docker compose file to fix the issue

environment:
      - MYSQL_ROOT_PASSWORD=${MYSQLDB_ROOT_PASSWORD}
      - MYSQL_DATABASE=${MYSQLDB_DATABASE}      
      - MYSQL_ROOT_HOST=%