mysql-docker-container - ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)

Madhu

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 ?

Mihai

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

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)

mysql -v ERROR 1045 (28000): Access denied for user root'@'localhost' (using password: NO)

Cannot connect to MySql database: ERROR 1045 (28000): Access denied for user 'root'@'localhost'

I got ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO) with the command sudo mysql on ubuntu

MySql ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)

MySQL ERROR 1045 (28000): Access denied for user 'bill'@'localhost' (using password: YES)

ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO) on MAC OSX

My ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)

openproject configure throws "ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)"?

ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO), can't reset password either

MYSQL_ROOT_PASSWORD is set but getting "Access denied for user 'root'@'localhost' (using password: YES)" in docker container

mysql (mariadb) ERROR 1698 (28000): Access denied for user 'root'@'localhost'

access phpmyadmin on localhost & reconfigure phpmyadmin: ERROR 1045 (28000): Access denied for user 'root'@'localhost'

ERROR 1045 (28000): Access denied for user 'username'@'%' (using password: YES)

ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)

mysqlfailover command gives Error 1045: Access denied for user 'root'@'localhost' (using password: NO)

[PDOException]: SQLSTATE[28000] [1045] Access denied for user 'root'@'localhost' (using password: NO) Symfony2

lavaral 5 ERROR{ (SQLSTATE[HY000] [1045] Access denied for user 'root'@'localhost' (using password: YES)}

ERROR 1045 (28000): Access denied for user 'usr'@'%' (using password: YES)

ERROR 1698 (28000): Access denied for user 'root'@'localhost, on MySQL 5.7

Mysql ERROR 1045 (28000) at line 1: Access denied for user 'abc'@'slave4' (using password: YES)

ERROR 1045 (28000): Access denied for user 'root'@'%'

OperationalError: (1045, "Access denied for user 'root'@'localhost' (using password: YES)")

ERROR 1045 (28000): Access denied for user (using password: YES)

Rails database issue - ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)

ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES) after set plugin = ''

Brew mysql ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)

FIX MYSQL ERROR 1045 (28000): Access denied for user 'user'@'localhost' (using password: NO) in Linux

django:mysql:error(1045, "Access denied for user 'root'@'localhost' (using password: NO)")