Database URL & Connection String Generator

Generate connection strings for MySQL, PostgreSQL, SQLite, MongoDB, Redis, MariaDB, and MSSQL

  1. Home
  2. /
  3. Database Connection String Generator

Generated Connection String

mysql://root:@localhost:3306/mydb?charset=utf8mb4

Driver

-

Host

-

Database

-

Format

-

What Is a Database Connection String?

A database connection string (DSN) contains all the information needed to connect to a database: driver type, host, port, credentials, and options. Different frameworks and languages use different formats — URL-style, PDO DSN, SQLAlchemy, or CLI commands.

How to Use This Tool

  1. Select database type — Choose MySQL, MariaDB, PostgreSQL, SQLite, MongoDB, Redis, or MSSQL from the dropdown.
  2. Fill in connection details — Enter host, port, database name, username, and password. Ports auto-update when you select a database type.
  3. Add optional parameters — Append query parameters like charset=utf8mb4 or sslmode=require in the options field.
  4. Choose output format — Select URL Format, PHP PDO DSN, Python SQLAlchemy, or CLI Command.
  5. Copy the result — Click Copy to grab the generated connection string and use it in your application configuration.

Frequently Asked Questions

What is a connection string DSN?

A Data Source Name (DSN) is a string that contains all connection parameters needed to connect to a database, including driver, host, port, credentials, and optional settings. Different languages and frameworks use different DSN formats.

What output formats are supported?

Four formats are available: URL format (used by many ORMs), PHP PDO DSN (for PHP applications), Python SQLAlchemy (for Python apps), and CLI Command (for command-line database clients like mysql, psql, or redis-cli).

Are my database credentials secure?

Yes. All processing is done locally in your browser. No data, including passwords, is sent to any server.

Can I generate MongoDB connection strings?

Yes. Select MongoDB from the database type dropdown, and the tool will generate a properly formatted MongoDB connection URI (mongodb://user:pass@host:port/db).

Does the port update automatically?

Yes. When you change the database type, the port field updates to the default port for that database (e.g., 3306 for MySQL, 5432 for PostgreSQL, 27017 for MongoDB). You can still override it manually.

Last updated: 9 Jul 2026