'Docker container connect with external mysql database

I am creating a sample spring boot mysql docker application using docker compose. Here I have two docker containers. One for spring boot web application and another one for mysql database. Now I want to connect this spring boot web application container to an external mysql DB instead of the mysql docker container. Which changes do I need to apply for below docker-compose.yaml file for connecting to an external mysql database ?

#docker-compose version
version: "3"
services:
  mysql-standalone:
    image: mysql:5.6
    environment:
      - MYSQL_ROOT_PASSWORD=xxxxxx
      - MYSQL_DATABASE=test
  user-web-app:
    #Build the image using the docker file which is in the current folder
    build: .
    ports:
      - "8083:8080"
    environment:
      SPRING_APPLICATION_JSON: '{
            "spring.datasource.url"  : "jdbc:mysql://mysql-standalone:3306/test?autoReconnect=true&useSSL=false",
            "spring.datasource.username" : "root",
            "spring.datasource.password" : "xxxxxx",
            "spring.jpa.properties.hibernate.dialect" : "org.hibernate.dialect.MySQL5InnoDBDialect",
            "spring.jpa.hibernate.ddl-auto" : "update"
          }'
    depends_on:
      - mysql-standalone


Sources

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

Source: Stack Overflow

Solution Source