MySQL

To setup MySQL state store create a component of type . See this guide on how to create and apply a state store configuration.

Warning

The above example uses secrets as plain strings. It is recommended to use a secret store for the secrets as described here.

If you wish to use MySQL as an actor store, append the following to the yaml.

Dapr can use any MySQL instance - containerized, running on your local dev machine, or a managed cloud service.

Run an instance of MySQL. You can run a local instance of MySQL in Docker CE with the following command:

This example does not describe a production configuration because it sets the password in plain text and the user name is left as the MySQL default of “root”.

  1. Install MySQL into your cluster.

  2. Next, we’ll get our password, which is slightly different depending on the OS we’re using:

    • Windows: Run [System.Text.Encoding]::UTF8.GetString([System.Convert]::FromBase64String($(kubectl get secret --namespace default dapr-mysql -o jsonpath="{.data.mysql-root-password}"))) and copy the outputted password.

    • Linux/MacOS: Run kubectl get secret --namespace default dapr-mysql -o jsonpath="{.data.mysql-root-password}" | base64 --decode and copy the outputted password.

  3. With the password you can construct your connection string.

If you are using MySQL on Azure see the Azure , for information on how to download the required certificate.

AWS MySQL

Replace the <CONNECTION STRING> value with your connection string. The connection string is a standard MySQL connection string. For example, "<user>:<password>@tcp(<server>:3306)/?allowNativePasswords=true".

Enforced SSL connection

If your server requires SSL your connection string must end with &tls=custom for example, . You must replace the <PEM PATH> with a full path to the PEM file. The connection to MySQL will require a minimum TLS version of 1.2.

  • Read this guide for instructions on configuring state store components