MySQL Environment Variables

Warning: MySQL for Pivotal Platform v2.4 is no longer supported because it has reached the End of General Support (EOGS) phase. To stay up to date with the latest software and security updates, upgrade to a supported version.

This topic provides a reference for the environment variables that Cloud Foundry stores for MySQL for PCF service instances. These variables include the credentials that apps use to access the service instances.


Applications running in Cloud Foundry gain access to the bound service instances via an environment variable credentials hash called VCAP_SERVICES. An example hash is show below:

  "p.mysql": [{
    "label": "p.mysql",
    "name": "my-instance",
    "plan": "db-medium",
    "provider": null,
    "syslog_drain_url": null,
    "tags": [
    "credentials": {
      "hostname": "",
      "jdbcUrl": "jdbc:mysql://\u0026password=z9z6eskdbs1rhtxt",
      "name": "service_instance_db",
      "password": "z9z6eskdbs1rhtxt",
      "port": 3306,
      "uri": "mysql://fefcbe8360854a18a7994b870e7b0bf5:z9z6eskdbs1rhtxt@",
      "username": "fefcbe8360854a18a7994b870e7b0bf5"
    "volume_mounts": []

You can search for your service by its name, given when creating the service instance, or dynamically via the tags or label properties. The credentials property can be used as follows:

  • The credentials properties uri, name, hostname, port, username, password, and jdbcUrl provide access to the MySQL protocol.

In common with all services in Pivotal Cloud Foundry (PCF), the VCAP_SERVICES environment variable for an app is only modified when the app is bound to a service instance. Users will need to cf unbind-service, cf bind-service and cf restage their app in this scenario.