Skip to content

MySQL Connection String

Builds a MySQL connection URI from individual parameters (host, port, database, username, password, charset, SSL mode). It conditionally appends query parameters for charset (if not utf8mb4) and ssl_mode (if not PREFERRED). Output is a single text connection string suitable for passing to downstream nodes or tools.

Usage

Use this node when you need a correctly formatted MySQL connection string to configure database-related nodes or external services. Provide your database connection details, then connect the text output to nodes that accept a connection string or store it for later use.

Inputs

FieldRequiredTypeDescriptionExample
hostTrueSTRINGDatabase hostname or IP address.db.example.com
portTrueINTDatabase port number.3306
databaseTrueSTRINGTarget database/schema name.analytics
usernameTrueSTRINGDatabase user name.db_user
passwordTruePASSWORDDatabase user password.
charsetTrueSTRINGCharacter set for the connection. If left as utf8mb4, it will not be added to the URI.utf8mb4
ssl_modeTrueENUM[DISABLED, PREFERRED, REQUIRED, VERIFY_CA, VERIFY_IDENTITY]SSL connection mode. If PREFERRED, it will not be added to the URI; other values will be appended as a query parameter.REQUIRED

Outputs

FieldTypeDescriptionExample
textSTRINGThe constructed MySQL connection string (URI). Other output channels are empty for this node.mysql://db_user:@db.example.com:3306/analytics?ssl_mode=REQUIRED
jsonSTRINGEmpty string for this node.
htmlSTRINGEmpty string for this node.
xlsxBYTESEmpty for this node.
pdfBYTESEmpty for this node.

Important Notes

  • Default parameters: charset=utf8mb4 and ssl_mode=PREFERRED are not included in the URI unless changed.
  • No validation/test: This node only constructs a string; it does not validate credentials or test the connection.
  • Special characters: Username/password are not URL-encoded by this node. If they contain special characters (e.g., @, :, /, ?), the resulting URI may be invalid. Prefer credentials without such characters or pre-encode them.
  • URI scheme: Uses the mysql:// scheme with the format mysql://username:password@host:port/database and optional query parameters.
  • Security: Avoid exposing the resulting URI in logs or shares as it contains credentials.

Troubleshooting

  • Connection fails downstream: Verify host, port, database, credentials, and that the resulting URI matches the target tool's expected format.
  • SSL handshake errors: Adjust ssl_mode to match your server configuration (e.g., REQUIRED, VERIFY_CA) or set to DISABLED/PREFERRED if appropriate.
  • Authentication errors: Ensure username/password are correct and consider URL-encoding if they contain special characters.
  • Driver rejects URI: Some drivers require mysql+pymysql:// or another dialect prefix. Confirm the consumer's expected scheme and adapt if necessary.