Answer the question
In order to leave comments, you need to log in
How to connect to mysql via phpmyadmin in docker (laradock)?
Installed laradock. The settings are almost all default. Container launch successful. In browser phpmyadmin can't connect to mysql, throws an error.
Through docker-compose exec mysql bash I connect normally.
Answer the question
In order to leave comments, you need to log in
docker-compose.yml is too big, over 10k characters. I can only show part of it.
docker-compose.yml:
### 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
- MYSQL_USER=${PMA_USER}
- MYSQL_PASSWORD=${PMA_PASSWORD}
- MYSQL_ROOT_PASSWORD=${PMA_ROOT_PASSWORD}
ports:
- "${PMA_PORT}:80"
depends_on:
- "${PMA_DB_ENGINE}"
networks:
- frontend
- backend
Файл .env:
### MYSQL #################################################
MYSQL_VERSION=latest
MYSQL_DATABASE=default
MYSQL_USER=default
MYSQL_PASSWORD=secret
MYSQL_PORT=3306
MYSQL_ROOT_PASSWORD=root
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
the solution is:
mysql -u root -proot
ALTER USER root IDENTIFIED WITH mysql_native_password BY 'root';
and you need to specify mysql as the server.
Rename the mysql service to db or link it to phpmyadmin, it does not see it.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question