// free tool

MySQL connection string builder

Build a MySQL connection URI, JDBC URL, ADO.NET string, ODBC string or Go DSN from one form, or paste one to see what every option does and catch insecure settings like allowPublicKeyRetrieval. It all runs in your browser: nothing you type is sent anywhere.

Open this connection in SQLly

Opens SQLly's connection editor filled in.

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.

MySQL connection string formats

MySQL has no single connection-string standard. Connector/J uses a JDBC URL with camelCase properties (sslMode, connectTimeout in milliseconds), MySqlConnector and Connector/NET use ADO.NET Server=...; strings, Connector/ODBC uses ODBC keywords, Go's driver has its own user:pass@tcp(host:3306)/db DSN, and MySQL Shell takes a URI with ssl-mode.

TLS defaults to PREFERRED almost everywhere: encrypted when the server supports it, but the certificate is not checked. VERIFY_IDENTITY (MySqlConnector: VerifyFull) checks the CA and the host name.

URI MySQL Shell, mysql2, Prisma

mysql://app_user:[email protected]/sales?ssl-mode=VERIFY_IDENTITY

JDBC MySQL Connector/J

jdbc:mysql://db.example.com/sales?user=app_user&password=your_password&sslMode=VERIFY_IDENTITY

ADO.NET MySqlConnector, MySql.Data

Server=db.example.com;Database=sales;User ID=app_user;Password=your_password;SslMode=VerifyFull;

ODBC MySQL Connector/ODBC

Driver={MySQL ODBC 8.0 Unicode Driver};Server=db.example.com;Database=sales;Uid=app_user;Pwd=your_password;SslMode=VERIFY_IDENTITY;

Go DSN github.com/go-sql-driver/mysql

app_user:your_password@tcp(db.example.com)/sales?tls=true

SQLAlchemy URL Python SQLAlchemy with PyMySQL

mysql+pymysql://app_user:[email protected]/sales?charset=utf8mb4

Placeholders such as your_password are just that: build your own string with the form above. More about connecting SQLly to MySQL: SQLly for MySQL.

MySQL Connector/J properties

URL form: jdbc:mysql://[host][:port][/database][?property=value&...]. Percent-encode reserved characters (/ : @ ( ) [ ] & # = ? and space) everywhere, including the user and password.

KeywordSynonymsDefaultWhat it does
user / password - - Credentials.
sslMode - PREFERRED DISABLED, PREFERRED, REQUIRED, VERIFY_CA, VERIFY_IDENTITY.
useSSL / requireSSL / verifyServerCertificate - - Deprecated; still translated (useSSL=false = DISABLED). sslMode wins.
connectTimeout - 0 (none) Milliseconds to wait for the socket to connect.
socketTimeout - 0 (none) Milliseconds a read may block.
allowPublicKeyRetrieval - false Let the client request the server's RSA key for caching_sha2_password without TLS.
connectionTimeZone serverTimezone LOCAL LOCAL, SERVER or a zone ID.
characterEncoding - utf8mb4 (8.0.26+) Java character set.
trustCertificateKeyStoreUrl - - Trust store with the server's CA, for VERIFY_CA / VERIFY_IDENTITY.
rewriteBatchedStatements - false Rewrites batched INSERTs into multi-row statements.

MySqlConnector (ADO.NET) options

MySqlConnector and Oracle's Connector/NET (MySql.Data) share most keywords. Values with ; go in double quotes.

KeywordSynonymsDefaultWhat 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.

KeywordSynonymsDefaultWhat 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.

MySQL Connector/ODBC keywords

Keywords are case-insensitive. The driver name must match what your ODBC manager registered, which carries the version.

KeywordSynonymsDefaultWhat it does
Driver - - e.g. {MySQL ODBC 8.0 Unicode Driver}.
Server - localhost Host.
Port - 3306 TCP port.
Database - - Default schema.
User UID - User name.
Password PWD - Password.
SSLMODE ssl-mode (8.0.29+) PREFERRED DISABLED, PREFERRED, REQUIRED, VERIFY_CA, VERIFY_IDENTITY.

Common MySQL connection errors

Access denied for user 'app_user'@'10.0.0.7' (using password: YES)

Why: Error 1045: wrong password, or the account exists for another host pattern ('app_user'@'localhost' is a different account from 'app_user'@'%').

Fix: Check the password and SELECT user, host FROM mysql.user; create or grant the account for the host you connect from.

Public Key Retrieval is not allowed

Why: Connector/J with MySQL 8's caching_sha2_password on a connection without TLS: the driver needs the server's RSA key to send the password and is not allowed to ask for it.

Fix: Use TLS (sslMode=REQUIRED or stronger). allowPublicKeyRetrieval=true also works but is open to an attacker in the middle on an untrusted network.

Can't connect to MySQL server on 'db.example.com:3306' (110)

Why: Error 2003: the server is not reachable: wrong host or port, bind-address limited to 127.0.0.1, or a firewall. (111 means connection refused, 110 a timeout.)

Fix: Check bind-address and port in my.cnf, the firewall and the cloud security group, then test with nc -vz db.example.com 3306.

Host '10.0.0.7' is not allowed to connect to this MySQL server

Why: Error 1130: no account matches the user name with your client's host.

Fix: Create the account for your host or a pattern: CREATE USER 'app_user'@'10.0.0.%' ... and grant it the privileges it needs.

Unknown database 'sales'

Why: Error 1049: the schema in the string does not exist, or its name differs in case on a server with case-sensitive table names.

Fix: Check SHOW DATABASES; and the exact spelling.

Authentication plugin 'caching_sha2_password' cannot be loaded

Why: An old client library that predates MySQL 8's default authentication plugin.

Fix: Upgrade the client or connector. Changing the account to mysql_native_password is a stopgap; that plugin is deprecated.

MySQL connection string FAQ

What is the MySQL connection string format?

It depends on the driver. JDBC: jdbc:mysql://host:3306/db?user=...&password=.... ADO.NET: Server=host;Port=3306;Database=db;User ID=user;Password=...;. Go: user:password@tcp(host:3306)/db. MySQL Shell and many Node and ORM tools take mysql://user:password@host:3306/db.

What is the default MySQL port?

3306 for the classic protocol and 33060 for the X Protocol (mysqlx://).

Should I use useSSL=false?

No. useSSL is deprecated in Connector/J; use sslMode. sslMode=DISABLED (what useSSL=false maps to) sends queries and results in plain text. Use VERIFY_IDENTITY with the server's CA where you can, or at least REQUIRED.

Is allowPublicKeyRetrieval=true safe?

Only over TLS or a trusted network. MySQL 8's default caching_sha2_password needs either TLS or the server's RSA public key to send the password. Letting the client fetch that key unauthenticated means an attacker in the middle can hand over their own key and read the password. Prefer TLS (sslMode=REQUIRED or stronger).

Do I need to escape the password in a Go MySQL DSN?

No. go-sql-driver/mysql documents that the password can contain any character without escaping; the driver splits at the last @. Query parameter values must be URL-escaped, and parameter names are case-sensitive (parseTime, not parsetime).

Why is connectTimeout so large in JDBC?

Connector/J's connectTimeout and socketTimeout are in milliseconds, and both default to 0, meaning no limit. connectTimeout=10000 is ten seconds. MySqlConnector's Connection Timeout is in seconds (default 15).

// skip the strings entirely

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 MySQL and more.