Connect and verify TLS
Every managed database accepts encrypted connections only. This page shows the connection details for each engine, ready-made settings for common clients, and how to verify the server's certificate. Before connecting from outside Hubfly space, make sure your network may reach the instance: see Network access.
The Connect page
Open the database and go to Connect.
- Credentials shows the host, port, database and admin user for PostgreSQL and MySQL, or the libSQL URL and HTTP URL for libSQL. Anyone with Database read can see these.
- Reveal shows the admin password for one minute. It needs Database admin, and every reveal is recorded in the access log.
- Connection string and snippets has a format for each common client. The password is filled in while it is revealed; otherwise it is masked.
- TLS required shows the TLS setting clients use, and Download CA certificate saves the instance's certificate as
<name>-ca.pem.
The same details are available from the CLI:
hubfly db info app-db # host, port, database, user, TLS and access
hubfly db url app-db --reveal # full URL with the password
hubfly db env app-db --reveal >> .env # DATABASE_URL=... for a .env file
hubfly db url app-db --database analytics # URL for another database on the instanceUse the port Hubfly space assigns
app-db-k3x9.db.hubfly.app:31544, the default database app and the admin user admin.PostgreSQL
Connection URL (the password is percent-encoded inside URLs):
postgresql://admin:<password>@app-db-k3x9.db.hubfly.app:31544/app?sslmode=requirepsql, or hubfly db connect app-db, which starts psql for you without putting the password on the command line:
psql 'postgresql://admin:<password>@app-db-k3x9.db.hubfly.app:31544/app?sslmode=require'Environment variables that psql and libpq-based clients read:
DATABASE_URL=postgresql://admin:<password>@app-db-k3x9.db.hubfly.app:31544/app?sslmode=require
PGHOST=app-db-k3x9.db.hubfly.app
PGPORT=31544
PGUSER=admin
PGPASSWORD=<password>
PGDATABASE=app
PGSSLMODE=requirenode-postgres (pg):
import pg from "pg";
const pool = new pg.Pool({
connectionString: process.env.DATABASE_URL,
ssl: { rejectUnauthorized: false },
});Prisma reads the URL from DATABASE_URL:
DATABASE_URL="postgresql://admin:<password>@app-db-k3x9.db.hubfly.app:31544/app?sslmode=require"Drizzle with node-postgres:
import { drizzle } from "drizzle-orm/node-postgres";
const db = drizzle({
connection: {
connectionString: process.env.DATABASE_URL!,
ssl: { rejectUnauthorized: false },
},
});The Connect page also has snippets for Python (psycopg), Go (pgx), JDBC and PHP (PDO). rejectUnauthorized: false keeps the connection encrypted but skips the certificate check, like sslmode=require; to check it too, see Verify the server certificate.
MySQL
Connection URL:
mysql://admin:<password>@app-db-k3x9.db.hubfly.app:31544/app?ssl-mode=REQUIREDmysql client, or hubfly db connect orders:
mysql --host=app-db-k3x9.db.hubfly.app --port=31544 --user='admin' --password='<password>' --ssl-mode=REQUIRED 'app'mysql2 for Node.js:
import mysql from "mysql2/promise";
const db = await mysql.createConnection({
host: "app-db-k3x9.db.hubfly.app",
port: 31544,
user: "admin",
password: process.env.MYSQL_PASSWORD,
database: "app",
ssl: { rejectUnauthorized: false },
});Prisma uses its own TLS parameter for MySQL:
DATABASE_URL="mysql://admin:<password>@app-db-k3x9.db.hubfly.app:31544/app?sslaccept=accept_invalid_certs"The Connect page also has snippets for Python (PyMySQL), Go (go-sql-driver/mysql), JDBC and PHP (PDO). An app binding writes the ?ssl-mode=REQUIRED form of the URL into DATABASE_URL.
SQLite (libSQL)
libSQL is served over HTTPS on port 443 with a publicly trusted certificate, so there is nothing to configure for TLS. There is no password: every client authenticates with an access token, created under Tokens or with hubfly db tokens create and shown once.
LIBSQL_URL=libsql://notes-p2m4.db.hubfly.app
LIBSQL_AUTH_TOKEN=<token>@libsql/client:
import { createClient } from "@libsql/client";
const db = createClient({
url: process.env.LIBSQL_URL!,
authToken: process.env.LIBSQL_AUTH_TOKEN,
});
const rows = await db.execute("select 1");Drizzle:
import { drizzle } from "drizzle-orm/libsql";
const db = drizzle({
connection: {
url: process.env.LIBSQL_URL!,
authToken: process.env.LIBSQL_AUTH_TOKEN!,
},
});Plain HTTP, using the HTTP URL from the Connect page:
curl -s https://notes-p2m4.db.hubfly.app/v2/pipeline \
-H "Authorization: Bearer $LIBSQL_AUTH_TOKEN" \
-H "Content-Type: application/json" \
-d '{"requests":[{"type":"execute","stmt":{"sql":"select 1"}},{"type":"close"}]}'hubfly db connect does not apply to libSQL; use hubfly db query or a libSQL client.
Verify the server certificate
Each PostgreSQL and MySQL instance has its own self-signed certificate, issued by Hubfly space for that instance and its hostname. sslmode=require and ssl-mode=REQUIRED encrypt the connection but do not check who answers. To also verify the server, download the instance's CA certificate and point your client at it:
hubfly db cert app-db --output app-db-ca.pem
# or: Connect → Download CA certificate| Client | Encrypt only | Encrypt and verify |
|---|---|---|
| psql and libpq | sslmode=require | sslmode=verify-full&sslrootcert=app-db-ca.pem |
| node-postgres, Drizzle | ssl: { rejectUnauthorized: false } | ssl: { ca: fs.readFileSync("app-db-ca.pem", "utf8") } |
| mysql client | --ssl-mode=REQUIRED | --ssl-mode=VERIFY_IDENTITY --ssl-ca=app-db-ca.pem |
| mysql2 | ssl: { rejectUnauthorized: false } | ssl: { ca: fs.readFileSync("app-db-ca.pem", "utf8") } |
psql 'postgresql://admin:<password>@app-db-k3x9.db.hubfly.app:31544/app?sslmode=verify-full&sslrootcert=app-db-ca.pem'import fs from "node:fs";
import pg from "pg";
const pool = new pg.Pool({
host: "app-db-k3x9.db.hubfly.app",
port: 31544,
user: "admin",
password: process.env.PGPASSWORD,
database: "app",
ssl: { ca: fs.readFileSync("app-db-ca.pem", "utf8") },
});The certificate belongs to one instance; download it separately for each database you verify. libSQL needs no download: its certificate is publicly trusted.
Rotate the admin password
Rotate password on the Connect page, or hubfly db credentials rotate, replaces the admin password. The new password is shown once.
- Existing connections stay open; new connections need the new password.
- App bindings that use the admin user get the new URL automatically. Redeploy those apps so they use it.
- Update every other client and
.envfile yourself. - On libSQL, rotating replaces the token signing key instead, which invalidates every token. Connected apps receive new tokens.
To limit the impact of a rotation, give each app its own user: see Users, databases and tokens.
If a connection fails
| Symptom | Check |
|---|---|
| Timeout or connection refused | The instance is running, public access is on, and your IP is in the allowlist (or the list is empty). hubfly db network app-db shows all three; hubfly db network allow app-db --my-ip adds your address. |
| Wrong port | Use the port from the Connect page, not 5432 or 3306. |
| TLS or SSL required error | Add sslmode=require (PostgreSQL) or ssl-mode=REQUIRED (MySQL). Unencrypted connections are refused. |
| Certificate verification failed | Use require, or verify against the instance's own CA certificate as shown above. System CA bundles do not include it. |
| Password authentication failed | The password may have been rotated. Reveal it again, and percent-encode it inside URLs. |
| libSQL rejects the token | The token expired, or a revocation or rotation invalidated it. Create a new token. |