berzas
berzas

Reputation: 133

docker-compose phpmyadmin kicks out

I'm trying to use a docker-compose.yml for launching mariabd and phpmyadmin. When I edit something on phpmyadmin it kicks me out to login page.

db:
  image: mariadb
  environment:
    MYSQL_ROOT_PASSWORD: Pass123
  restart: always
  volumes:
    - "./.data/db:/var/lib/mysql/:rw"
phpmyadmin:
  image: phpmyadmin/phpmyadmin
  links:
    - db:mysql
  ports:
    - 8181:80
  environment:
    MYSQL_USERNAME: root
    MYSQL_ROOT_PASSWORD: Pass123
    PMA_HOST: mysql

I've tried with a volume container with busybox to keep data of mysql, changed mariabd for mysql image. But I don't get with the solution. What should I do to solve this?

Thanks in advance

Upvotes: 1

Views: 2390

Answers (2)

JL M
JL M

Reputation: 1468

I don't understand the meaning of the link

links:
- db:mysql

The configuration file of phpmyadmin/phpmyadmin (/www/config.inc.php) say by default the host name of database server if 'db' :

$hosts = array('db');

As you name the database server 'db' then link should be write likez this :

links:
- db

If your database name container is not 'db', you should add the environment variable PMA_HOST= (or PMA_HOSTS if multi db servers) with the right name

All over environment variables are useless (even in db config I think)

Upvotes: 0

ivan.sim
ivan.sim

Reputation: 9298

The set of environmental variables supported by the phpmyadmin/phpmyadmin Docker image is different from that of the mariadb image. Try replacing the MYSQL_USERNAME and MYSQL_ROOT_PASSWORD variables of your phpmyadmin service with PMA_USER and PMA_PASSWORD, respectively.

Upvotes: 2

Related Questions