E
E
evg5012019-04-09 12:53:00
PHP
evg501, 2019-04-09 12:53:00

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.
5cac6a561da40659286210.png
5cac6a5ea8c7b237170167.png
5cac6a6561212245179512.png
5cac6a6df3ab2487249992.png
Through docker-compose exec mysql bash I connect normally.
5cac6b5e237b1512243767.png

Answer the question

In order to leave comments, you need to log in

4 answer(s)
E
evg501, 2019-04-09
@evg501

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.

A
Alexey Shashenkov, 2019-04-09
@teknik2008

docker-compose show or result

docker ps

P
pawnoholic, 2019-04-14
@pawnoholic

Rename the mysql service to db or link it to phpmyadmin, it does not see it.

S
SlyFox, 2019-05-13
@SlyFox

try rolling back mysql version to 5.7
in .env file
MYSQL_VERSION
=5.7
and then do
docker-compose build --no-cache mysql
docker-compose up -d mysql
i had this issue

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question