MariaDB connection string builder
Build a MariaDB JDBC URL, ADO.NET string or Go DSN from one form, or paste one to see what every option does and whether TLS is really checked. It all runs in your browser: nothing you type is sent anywhere.
Open this connection in SQLly
Opens SQLly's connection editor filled in.
Open this connection in SQLly
Private by design. The builder and decoder are plain JavaScript running in this tab. The page sends no request with what you type, stores nothing (not even in your browser), and keeps working offline once loaded. The Open in SQLly link goes from your browser straight to the app on your computer.
MariaDB connection string formats
MariaDB speaks the MySQL protocol, so MySQL drivers (MySqlConnector, go-sql-driver/mysql, mysql2) connect to it with the same strings. MariaDB's own Connector/J uses jdbc:mariadb:// and different sslMode words than MySQL's: disable, trust, verify-ca, verify-full.
Watch the Connector/J default: version 3.x connects without TLS when sslMode is not set, and 4.0 switched the default to verify-full, which fails against a server with a self-signed certificate.
JDBC MariaDB Connector/J
jdbc:mariadb://db.example.com/sales?user=app_user&password=your_password&sslMode=verify-full
ADO.NET MySqlConnector
Server=db.example.com;Database=sales;User ID=app_user;Password=your_password;SslMode=VerifyFull;
Go DSN github.com/go-sql-driver/mysql
app_user:your_password@tcp(db.example.com)/sales?tls=true
SQLAlchemy URL MariaDB Connector/Python
mariadb+mariadbconnector://app_user:[email protected]/sales
URI SQLly and URI-style tools
mariadb://app_user:[email protected]/sales?ssl-mode=VERIFY_IDENTITY
Placeholders such as your_password are just that: build your own string with the form above. More about connecting SQLly to MariaDB: SQLly for MariaDB.
MariaDB Connector/J options
URL form: jdbc:mariadb:[replication:|loadbalance:|sequential:]//host[:port][,...]/[database][?key=value&...]. Connector/J 3.x only accepts jdbc:mysql: with permitMysqlScheme.
| Keyword | Synonyms | Default | What it does |
|---|---|---|---|
user / password |
- | - | Credentials. |
sslMode |
- | disable (3.x); verify-full (4.0+) | disable, trust (encrypt, no checks), verify-ca, verify-full, and allow (3.5.11+). |
serverSslCert |
- | - | CA or server certificate (path or PEM) for verify-ca / verify-full. |
connectTimeout |
- | 30000 | Milliseconds to wait for the connection. |
socketTimeout |
- | 0 | Milliseconds a read may block. |
allowPublicKeyRetrieval |
- | false | Request the server's RSA key without TLS. |
MySqlConnector (ADO.NET) options
MySqlConnector and Oracle's Connector/NET (MySql.Data) share most keywords. Values with ; go in double quotes.
| Keyword | Synonyms | Default | What it does |
|---|---|---|---|
Server |
Host, Data Source, Address | localhost | Host, comma list, or a Unix socket path. |
Port |
- | 3306 | TCP port. |
User ID |
UID, User, Username | - | User name. |
Password |
PWD | - | Password. |
Database |
Initial Catalog | - | Default schema. |
SslMode |
SSL Mode | Preferred | None/Disabled, Preferred, Required, VerifyCA, VerifyFull. |
SslCa |
CA Certificate File, Ssl-Ca | - | CA file for VerifyCA / VerifyFull. |
Connection Timeout |
Connect Timeout | 15 | Seconds. |
Default Command Timeout |
Command Timeout | 30 | Seconds; 0 waits forever. |
Application Name |
- | - | Sets the program_name connection attribute. |
AllowPublicKeyRetrieval |
- | false | See the warning above. |
AllowUserVariables |
- | false | Allow @variables in SQL. |
Pooling |
- | true | Connection pooling. |
Maximum Pool Size |
Max Pool Size | 100 | Largest pool. |
Minimum Pool Size |
Min Pool Size | 0 | Smallest pool. |
go-sql-driver/mysql DSN
Form: [user[:password]@][protocol[(address)]]/dbname[?param=value&...]. The password needs no escaping; the database name is path-escaped (1.8+); parameter values are query-escaped; parameter names are case-sensitive.
| Keyword | Synonyms | Default | What it does |
|---|---|---|---|
tcp(host:port) |
unix(/path) | tcp(127.0.0.1:3306) | Address; the port defaults to 3306. |
tls |
- | false | true (verify), false, skip-verify (encrypt, no checks), preferred, or a registered config name. |
timeout |
- | OS default | Dial timeout with a unit: 10s. |
readTimeout / writeTimeout |
- | 0 | I/O timeouts with a unit. |
parseTime |
- | false | Scan DATE and DATETIME into time.Time. |
loc |
- | UTC | Time zone for time.Time values (escape / as %2F). |
collation |
- | utf8mb4_general_ci | Connection collation. |
allowCleartextPasswords |
- | false | Send the password in clear (only over TLS). |
multiStatements |
- | false | Several statements per query; widens SQL injection impact. |
Common MariaDB connection errors
Access denied for user 'app_user'@'10.0.0.7' (using password: YES)
Why: Wrong password, or the account is defined for another host pattern.
Fix: Check SELECT user, host FROM mysql.user and create or grant the account for the host you connect from.
Could not connect to address=(host=db.example.com)(port=3306)(type=primary) : ... certificate
Why: Connector/J 4.0+ defaults to sslMode=verify-full, and the server presents a self-signed certificate or one for another name.
Fix: Give the driver the CA with serverSslCert=/path/ca.pem, or use a certificate for the host name you connect to. sslMode=trust encrypts without checking and is only for trusted networks.
Host '10.0.0.7' is not allowed to connect to this MariaDB server
Why: No account matches your user name and client host.
Fix: Create the account for your host or a pattern such as 'app_user'@'10.0.0.%'.
Unknown database 'sales'
Why: The database in the string does not exist or is spelled differently.
Fix: Check SHOW DATABASES;.
MariaDB connection string FAQ
Can I use a MySQL driver with MariaDB?
Yes, for the common cases. MariaDB keeps the MySQL client protocol, so MySqlConnector, Connector/NET, go-sql-driver/mysql, mysql2 and PyMySQL connect with the same strings. MariaDB-specific features are covered best by MariaDB's own connectors.
What does sslMode=trust mean?
It is MariaDB Connector/J's equivalent of MySQL's REQUIRED: the connection is encrypted, but the server certificate is not checked. Use verify-full with serverSslCert to also verify the server.
What is the default MariaDB port?
3306, the same as MySQL.
Why did my MariaDB JDBC connection break after upgrading Connector/J?
Connector/J 4.0 changed the sslMode default from disable to verify-full. A server without TLS, or with a self-signed certificate, now fails. Configure TLS properly, or set sslMode explicitly.
Other engines
Connect once. Then just write SQL.
SQLly is a native SQL workbench for macOS, Windows and Linux. Paste a connection string into its connection editor, keep passwords in your system keychain, and get schema-aware IntelliSense on MariaDB and more.