Skip to main content
Version: v0.14 🚧

mysql

Schema MySQL

MySQL describes the attributes to locally deploy or create a cloud provider
managed mysql database instance for the workload.

Attributes

nametypedescriptiondefault value
type required"local""cloud"Type defines whether the mysql database is deployed locally or provided by
cloud vendor.
version requiredstrVersion defines the mysql version to use.

Examples

# Instantiate a local mysql database with version of 5.7. 

import mysql

accessories: {
"mysql": mysql.MySQL {
type: "local"
version: "8.0"
}
}

Credentials and Connectivity

For sensitive information such as the host, username and password for the database instance, Kusion will automatically inject them into the application container for users through environment variables. The relevant environment variables are listed in the table below.

NameExplanation
KUSION_DB_HOST_<DATABASE_NAME>Host address for accessing the database instance
KUSION_DB_USERNAME_<DATABASE_NAME>Account username for accessing the database instance
KUSION_DB_PASSWORD_<DATABASE_NAME>Account password for accessing the database instance

The databaseName can be declared in workspace configs of mysql, and Kusion will automatically concatenate the <PROJECT_NAME>, <STACK_NAME>, <APP_NAME> and mysql with - if not specified. When injecting the credentials into containers' environment variables, Kusion will convert the databaseName to uppercase, and replace - with _.