I've had the same error installing docker using laradock, then running docker-compose up. Out of the box, default config throws this error when you attempt to log into phpMyAdmin (using current images as of Oct 2018). The error was not present using docker run.
For docker-compose.yml (version 3), one cause is services running on different networks by default. For anyone else having this issue, here is a config that works for mysql and phpmyadmin.
Inside "docker-compose.yml" file, under "services":
### db ###################################################
db:
image: mysql:5.7
container_name: db
environment:
- MYSQL_ROOT_PASSWORD=mypass
networks:
- backend
### MySQL ################################################
mysql:
build:
context: ./mysql
args:
- MYSQL_VERSION=${MYSQL_VERSION}
environment:
- MYSQL_DATABASE=${MYSQL_DATABASE}
- MYSQL_USER=${MYSQL_USER}
- MYSQL_PASSWORD=${MYSQL_PASSWORD}
- MYSQL_ROOT_PASSWORD=${MYSQL_ROOT_PASSWORD}
- TZ=${WORKSPACE_TIMEZONE}
volumes:
- ${DATA_PATH_HOST}/mysql:/var/lib/mysql
- ${MYSQL_ENTRYPOINT_INITDB}:/docker-entrypoint-initdb.d
ports:
- "${MYSQL_PORT}:3306"
networks:
- backend
## phpMyAdmin ###########################################
phpmyadmin:
build: ./phpmyadmin
environment:
- PMA_ARBITRARY=1
- PMA_HOST=db
- MYSQL_USER=${PMA_USER}
- MYSQL_PASSWORD=${PMA_PASSWORD}
- MYSQL_ROOT_PASSWORD=${PMA_ROOT_PASSWORD}
ports:
- "${PMA_PORT}:80"
depends_on:
- db
- mysql
networks:
- frontend
- backend
Edit the ".env" file as follows:
### MYSQL #################################################
MYSQL_VERSION=5.7
MYSQL_DATABASE=db
MYSQL_USER=root
MYSQL_PASSWORD=mypass
MYSQL_PORT=3306
MYSQL_ROOT_PASSWORD=mypass
MYSQL_ENTRYPOINT_INITDB=./mysql/docker-entrypoint-initdb.d
### PHP MY ADMIN ##########################################
# Accepted values: mariadb - mysql
PMA_DB_ENGINE=mysql
# Credentials/Port:
PMA_USER=default
PMA_PASSWORD=secret
PMA_ROOT_PASSWORD=secret
PMA_PORT=8080
Add the following line to the "/etc/hosts" file:
127.0.0.1 localhost
Assuming you're also using nginx, and that config is elsewhere in your "docker-compose.yml", you can build and start these services with:
docker-compose up -d mysql nginx db phpmyadmin
Then navigate to localhost:8080 in your browser and login with username "root" and password "mypass" (leave server field blank).