Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

2.3K
Visualizações
mysql-docker-container - ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)

i am creating mysql docker container using below docker-compose file. Service is created successfully but when i am trying to enter inside the container getting the below error ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)

docker container exec -it 966 /bin/bash
root@96607883960b:/# mysql -uroot -p
Enter password: 
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)
root@96607883960b:/# 



version: '3.3'

services:
   db:
    image: mysql:5.7.29
    container_name: mysql
    deploy:
      replicas: 1
      restart_policy:
        condition: on-failure
    environment:
      - MYSQL_USER="testpass"
      - MYSQL_PASSWORD="testpass"
      - MYSQL_ROOT_PASSWORD="testpass"
    ports:
      - 33060:3306
    volumes:
      - /Users/hello/Work/Volumes/wavolumes/mysql:/var/lib/mysql

i found many articles didn't help to resolve this issue

is any one having the solution for this issue ?

over 4 years ago · Santiago Trujillo
1 Respostas
Responde à pergunta

0

Your connection actually works and you can verify it running the following (service should be running already!):

docker-compose exec db sh -c 'mysql -uroot -p${MYSQL_ROOT_PASSWORD}'

The problem is that you are using the wrong password.

You can see your problem very easily by running docker-compose config. You will see in the output that the double quotes are included as part of the values.

This version should solve your issue:

version: '3.3'

services:
   db:
    image: mysql:5.7.29
    container_name: mysql
    deploy:
      replicas: 1
      restart_policy:
        condition: on-failure
    environment:
      - MYSQL_USER=testpass
      - MYSQL_PASSWORD=testpass
      - MYSQL_ROOT_PASSWORD=testpass
    ports:
      - 33060:3306
    volumes:
      - /Users/hello/Work/Volumes/wavolumes/mysql:/var/lib/mysql
over 4 years ago · Santiago Trujillo Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda