How to integrate with applications

Integrations (also relations) are connections between two applications with compatible endpoints. These connections simplify the creation and management of users, passwords, and other shared data.

This guide shows how to integrate Charmed MySQL with both charmed and non-charmed applications.

Integrate with a charmed application

Integrations with charmed applications are supported via the mysql_client interface.

Modern mysql_client interface

To integrate with a charmed application that supports the mysql_client interface, run

juju integrate mysql <charm>
juju integrate mysql-k8s <charm>

To remove the integration, run

juju remove-relation mysql <charm>
juju remove-relation mysql-k8s <charm>

Integrate with a non-charmed application

To integrate with an application outside of Juju, you must use the data-integrator charm to create the required credentials and endpoints.

Deploy data-integrator:

juju deploy data-integrator --config database-name=<name>

Integrate with MySQL:

juju integrate data-integrator mysql
juju integrate data-integrator mysql-k8s

Use the get-credentials action to retrieve credentials from data-integrator:

juju run data-integrator/leader get-credentials

Rotate applications password

To rotate the passwords of users created for related applications, the relation should be removed and related again. That process will generate a new user and password for the application.

juju remove-relation <charm> mysql
juju integrate <charm> mysql
juju remove-relation <charm> mysql-k8s
juju integrate <charm> mysql-k8s

Internal operator user

The operator user is used internally by the Charmed MySQL application. The set-password action can be used to rotate its password.

To set a specific password for the charmed-operator user, run

juju run mysql/leader set-password username=charmed-operator password=<password>
juju run mysql-k8s/leader set-password username=charmed-operator password=<password>

To randomly generate a password for the charmed-operator user, run

juju run mysql/leader set-password username=charmed-operator
juju run mysql-k8s/leader set-password username=charmed-operator