Infisical supports connecting to MySQL using a database role.

Configure a MySQL Role for Infisical

1

Create a Role

Infisical recommends creating a designated role in your MySQL database for your connection.

-- create user role
CREATE USER 'infisical_role'@'%' IDENTIFIED BY 'my-password';
2

Grant Relevant Permissions

Depending on how you intend to use your MySQL connection, you’ll need to grant one or more of the following permissions.

To learn more about MySQL’s permission system, please visit their documentation.

For Secret Rotations, your Infisical user will require the ability to alter other users’ passwords:

-- enable permissions to alter login credentials
GRANT CREATE USER ON *.* TO 'infisical_role'@'%';

-- Apply changes
FLUSH PRIVILEGES;
3

Get Connection Details

You’ll need the following information to create your MySQL connection:

  • host - The hostname or IP address of your MySQL server
  • port - The port number your MySQL server is listening on (default: 3306)
  • database - The name of the specific database you want to connect to
  • username - The role name of the login created in the steps above
  • password - The role password of the login created in the steps above
  • sslCertificate (optional) - The SSL certificate required for connection (if configured)

If you are self-hosting Infisical and intend to connect to an internal/private IP address, be sure to set the ALLOW_INTERNAL_IP_CONNECTIONS environment variable to true.

Create Connection in Infisical

  1. Navigate to the App Connections tab on the Organization Settings page.

  2. Select the MySQL Connection option.

  3. Select the Username & Password method option and provide the details obtained from the previous section and press Connect to MySQL.

Optionally, if you’d like Infisical to manage the credentials of this connection, you can enable the Platform Managed Credentials option. If enabled, Infisical will update the password of the connection on creation to prevent external access to this database role.

  1. Your MySQL Connection is now available for use.