Docker Compose - Connection to Phpmyadmin and MySQL not working
P粉615886660
P粉615886660 2023-08-28 09:00:04
<p>I need an easy way to create an environment with PHP, NGINX, MySQL, and phpmyadmin using Docker-compose. </p> <p>I have successfully created a PHP environment using NGINX. </p> <p>Now I want to add a database with MySQL and phpmyadmin. These two components don't seem to work. For example, I cannot access phpmyadmin by specifying port "8081". I access the local server using the local IP address and the port at the end of the address. </p> <p>When I want to call phpmyadmin, the browser window tells me "Unable to connect to server". </p> <p>This is the docker-compose.yml file: </p> <pre class="brush:yaml;toolbar:false;">version: "3.9" services: web: image: nginx:latest ports: - "8080:80" volumes: - ./src:/var/www/html - ./default.conf:/etc/nginx/conf.d/default.conf links: -php-fpm php-fpm: image: php:8-fpm volumes: - ./src:/var/www/html mysql: image:mysql container_name: mysql environment: MYSQL_ROOT_PASSWORD: '<mypassword>' MYSQL_DATABASE:baton MYSQL_USER:baton MYSQL_PASSWORD: '<mypassword>' ports: - "3306:3306" volumes: - ./database/mysql:/var/lib/mysql phpmyadmin: image: phpmyadmin/phpmyadmin container_name: pma links: - mysql environment: PMA_HOST: mysql PMA_PORT: 3306 PMA_ARBITRARY: 1 restart: always ports: - 8081:80 </pre> <p>Hope everyone can help! </p>
P粉615886660
P粉615886660

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!