Databases And Persistence /
Deploy MySQL on Northflank
This guide explains how to quickly and easily deploy and use MySQL on Northflank.
|8.0.28||MySQL is a fast, reliable, scalable, and easy to use open-source relational database system.||Native or disk||Yes (cannot be changed after creation)|
Choose addon from the create new menu in the top right corner of the dashboard
Select MySQL and enter a name
Choose a version or leave as default (most recent version)
Choose whether to deploy with TLS. This cannot be changed later.
Choose whether to make the database publicly accessible. This will give your addon a URL and make it available online. TLS must be enabled to select this.
If you have secret groups in your project, choose ones to link to the addon so that the database can be used in services and jobs that inherit variables from the secret group. To link the database to a secret group:
- Show secret groups and configure the secret groups you wish to use
- Select suggested secrets from the database to link, or select all
- Set any required aliases for specific secrets to make them accessible by that name within your application
Select the required resources for your database. You can scale the database after creation, but available storage and replicas cannot be decreased once increased.
- Create addon and MySQL will begin provisioning, this may take a few minutes.
You can manually copy the connection secrets for your MySQL database from the connection details page into environment variables or build arguments of your workloads on Northflank.
However, it is much easier to link your database's connection details to a new or existing secret group.
The necessary secrets to connect your workload will vary depending on the application in your workload.
Some clients may use a URI-like connection string , while some clients may not support the connection string format.
The connection string takes the format
MYSQL_JDBC_URI (for Java applications using JDBC) connection strings will be automatically configured for your database, as well as the
CONNECT_COMMAND for command-line clients.
You can supply connections details and secrets such as
port to your workload if your application is configured to use these instead of a connection string.
|Internal port||External port||Protocol|
If you create more than one replica, read replicas will have the
read prefixes in place of the
primary prefix for the primary replica.
Automatically inherit database connection details into your workload
- Create a new secret group of environment variables to connect in the running workload
- Show addons and configure your addon with either the
MYSQL_JDBC_URIconnection string, or select connection details and secrets
- Set the aliases required in your workload to access the secrets
- Enable apply secrets to specific services/jobs and select the workloads you want to access the database
- Create secret group
- Go to one of the workloads that inherits from the group and check the environment page, you should see the inherited variables from the secret group
The connection string or secrets will now be available in your workload under the configured aliases, and your application will be able to connect to the database using them.
To forward your MySQL database for local access using the Northflank CLI, copy and execute the forward addon command from the local access section of the overview.
You can then use the
CONNECT_COMMAND from the connection details page to access your MySQL deployment using the command-line client, or use the connection details in your local development environment.
To access your MySQL database externally it must have been created with TLS enabled. If so, you can enable publicly accessible on the settings page under networking.