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¶
| Field | Required | Type | Description | Example |
|---|---|---|---|---|
| host | True | STRING | Database hostname or IP address. | db.example.com |
| port | True | INT | Database port number. | 3306 |
| database | True | STRING | Target database/schema name. | analytics |
| username | True | STRING | Database user name. | db_user |
| password | True | PASSWORD | Database user password. | |
| charset | True | STRING | Character set for the connection. If left as utf8mb4, it will not be added to the URI. | utf8mb4 |
| ssl_mode | True | ENUM[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¶
| Field | Type | Description | Example |
|---|---|---|---|
| text | STRING | The constructed MySQL connection string (URI). Other output channels are empty for this node. | mysql://db_user: |
| json | STRING | Empty string for this node. | |
| html | STRING | Empty string for this node. | |
| xlsx | BYTES | Empty for this node. | |
| BYTES | Empty 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.