docker-lamp
docker-lamp copied to clipboard
cant link phpmyadmin container with database
Hello
I am trying to connect official phpmyadmin container to this container, but cannot login to the database via web interface.
docker run --name new_db -dt -p 1880:80 fauria/lamp
docker run --name myadmin_test -d --link new_db:db -p 28080:80 phpmyadmin/phpmyadmin
I would get inside the container, and create a new user:
mysql -u root -p
CREATE USER 'newuser'@'localhost' IDENTIFIED BY 'password';
GRANT ALL PRIVILEGES ON * . * TO 'newuser'@'localhost';
I will get mysqli_real_connect(): (HY000/2002): Connection refused error when trying to login
On the other hand, I have no trouble connecting ot the official mariadb container:
docker run --name=testsql -e MYSQL_ROOT_PASSWORD=pass -d mariadb
docker run --name myadmin -d --link testsql:db -p 38080:80 phpmyadmin/phpmyadmin
This works just fine.
At the moment, my workaround is installing phpmyadmin inside the container, which works fine. I am on `Distributor ID: Ubuntu Description: Ubuntu 16.04.4 LTS Release: 16.04 Codename: xenial
Docker version 18.03.1-ce, build 9ee9f40
`