Version: '3'
Services:
nginx:
build:
context: ./lde/nginx
ports:
- 80:80
volumes:
- ./www:/var/www/html
- ./www/errors:/etc/nginx/html
- ../node_modules:/node_modules
depends_on:
- php
php:
build:
context: ./lde/php-fpm
volumes:
- ./www:/var/www/html
db:
image: mysql:8.0
restart: always
volumes:
- ./db:/var/lib/mysql
environment:
MYSQL_USER: root
MYSQL_ROOT_PASSWORD: toor
MYSQL_DATABASE: expense
adminer:
image: adminer:4.8.1
restart: always
ports:
- 8080:8080
I am building a docker based web application. Above is my docker-compose.yml, with all docker containers up and running, I navigate to localhost:8080 and provided the following details to the log in page of Adminer:
System: MySQL
Server: db
Username: root
Password: toor
Database: expense //I manually created a database 'expense' via command line
But got an error message: Access denied for user 'root'@172.18.0.3 (using password: YES)
, 172.18.0.3
is the ip address for adminer within the docker bridge network.
b0b1e
is the container ID for mysql container;
I could log into mysql server via command line: docker exec -it b0b1e mysql -u root
but if I tried logging into mysql server via command line using: docker exec -it b0b1e mysql -u root -p
, followed by typing in password toor
, I would get
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)
What have I done wrong here?
Found the issue,
Solution is to delete the existing mysql volume on my host machine and start fresh.