I have a simple docker setup using php7 and mysql, both from docker hub. Setting up is ok so far, everything starts up and I can access my app. But I can't get the mysql connect to work for me. I even logged in into the box and tried accessing the db, but it fails. Anybody any idea?
docker-compose.yml
db:
restart: always
image: mysql/mysql-server:5.7
ports:
- "3306:3306"
environment:
MYSQL_ROOT_PASSWORD: root
MYSQL_USER: myapp
MYSQL_PASSWORD: myapp
MYSQL_DATABASE: myapp
web:
restart: always
image: silintl/php7
command: php -S 0.0.0.0:8000 -t /app/web
links:
- db
ports:
- "8000:8000"
volumes:
- ../:/app
trying to access the db
[bash]marcobehnke@Marcos-MacBook-Pro-2 ~ $ docker exec -it docker_db_1 bash
[root@7eff3007bb11 /]# mysql --user=myapp --password=myapp --host=localhost --port=3306 myapp
mysql: [Warning] Using a password on the command line interface can be insecure.
ERROR 1045 (28000): Access denied for user 'myapp'@'localhost' (using password: YES)
[root@7eff3007bb11 /]#
What am I missing here?
Edit: Have a look at my github repo, this is the exact config I am using: https://github.com/firegate666/docker-php7-mysql-postgres
Ok, I took a different machine and tried my setup, it worked out of the box. I have no idea whyt this is about, but the problem is obviously my machine :-)
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments