搜尋

首頁  >  問答  >  主體

多個預設的MySQL伺服器在Docker的phpMyAdmin中是否可行?

<p>我正在嘗試使用Docker建置環境,其中包括兩個MySQL伺服器和一個phpMyAdmin伺服器,以便在開發過程中輕鬆分析資料。 我的docker-compose.yml檔案如下。 </p> <pre class="brush:php;toolbar:false;">version: "3.9" services: database1: container_name: Database1 image: mysql:8.0.28 command: --default-authentication-plugin=mysql_native_password restart: always environment: MYSQL_DATABASE: database1 MYSQL_ROOT_PASSWORD: somepassword MYSQL_USER: databaseuser1 MYSQL_PASSWORD: databaseuser1 ports: - "3306:3306" volumes: - database-volume:/var/lib/mysql networks: - my_network database2: container_name: Database2 image: mysql:8.0.28 command: --default-authentication-plugin=mysql_native_password restart: always environment: MYSQL_DATABASE: database2 MYSQL_ROOT_PASSWORD: somepassword MYSQL_USER: databaseuser2 MYSQL_PASSWORD: databaseuser2 ports: - "3307:3306" volumes: - second-database-volume:/var/lib/mysql networks: - my_network phpmyadmin: container_name: PhpMyAdmin image: phpmyadmin/phpmyadmin:5.1.3 restart: always depends_on: - database1 - database2 environment: PMA_HOST: database1, database2 PMA_PORT: 3306, 3307 PMA_USER: databaseuser1, databaseuser2 PMA_PASSWORD: databaseuser1, databaseuser2 ports: - "8080:80" networks: - my_network volumes: database-volume: second-database-volume: networks: my_network: driver: bridge</pre> <p>我想知道是否有內建的方法來實現這個目標。 </p>
P粉718730956P粉718730956500 天前516

全部回覆(1)我來回復

  • P粉466643318

    P粉4666433182023-08-26 16:00:19

    你是否嘗試將環境變數PMA_HOST改為PMA_HOSTS

    官方phpMyAdmin Docker映像

    回覆
    0
  • 取消回覆