I have mysql running through the docker, i.e. when I run the docker ps
command, I get this result:
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
fXX3aeXXcXXa mysql:5.7.22 "docker-entrypoint.s…" 35 minutes ago Up 18 minutes 0.0.0.0:3360->3306/tcp db
And here is my db
service in my docker-compose.yml
in my laravel root project:
# ... other services
db:
image: mysql:5.7.22
container_name: db
restart: unless-stopped
tty: true
ports:
- "3360:3306"
environment:
MYSQL_DATABASE: laravel_db
MYSQL_USER: root
MYSQL_PASSWORD: password
MYSQL_ROOT_PASSWORD: password
SERVICE_TAGS: dev
SERVICE_NAME: mysql
volumes:
- dbdata:/var/lib/mysql
- ./DockerDevelopment/mysql/my.cnf:/etc/mysql/my.cnf
networks:
- app-network
# other services ...
So, I try this command: docker exec -it db bash
then goes to my dockerized db command line, and I get this error:
root@fXX3aeXXcXXa:/# mysql -u root -p [ENTER]
Enter password: password
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)
what should I do to be able to access mysql>
in my docker?