'phpmyadmin can't connect to mariadb in docker

I'm trying to connect a phpmyadmin container to a nginx container with mariadb downloaded. I can access to phpmyadmin web site, but I can't log in to. An error code Cannot log in to the MySQL server and mysqli::real_connect(): (HY000/2002): Connection refused will appear. I made a bridge network "test-net", and connected the phpmyadmin container and the nginx container to the network. I commanded docker run -d --name phpmyadmin -e PMA_HOST=web -e PMA_PORT=3306 -p 8081:80 phpmyadmin/phpmyadmin for the phpmyadmin. Web is the nginx container and 3306 is my mariadb port number. How can I log in to my database in phpmyadmin?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source