Connect to a database
Open the database in the console. The Overview tab’s Connection Info card shows the host, port, database, username and password (click the eye to reveal it), plus Copy Connection String and a ready-made client command.
Connection details
Section titled “Connection details”| Detail | Example |
|---|---|
| Host | dark-rocket-k3x9.db.dockhive.xyz, one per database |
| Port | A port between 10000 and 19999, unique to your database (not the engine’s usual port) |
| Username | usr_1a2b3c4d |
| Password | Generated for you |
| Database | The name you chose (for RabbitMQ, the virtual host) |
Always copy the host and port from the console.
Connection strings
Section titled “Connection strings”With TLS on (the default):
| Engine | Connection string |
|---|---|
| PostgreSQL | postgresql://USER:PASSWORD@HOST:PORT/DBNAME?sslmode=require |
| MySQL, MariaDB | mysql://USER:PASSWORD@HOST:PORT/DBNAME?ssl-mode=REQUIRED |
| Redis | rediss://:PASSWORD@HOST:PORT/0 |
| RabbitMQ | amqps://USER:PASSWORD@HOST:PORT/VHOST |
Put the string in your app’s environment variables, for example as DATABASE_URL.
Client commands
Section titled “Client commands”psql "host=HOST port=PORT user=USER dbname=DBNAME sslmode=require"mysql -h HOST -P PORT -u USER -p DBNAME --ssl-mode=REQUIREDmariadb -h HOST -P PORT -u USER -p DBNAME --sslredis-cli -h HOST -p PORT --tls --insecure --askpassRedis uses a password only (no username). --insecure skips certificate verification; to verify, download the CA certificate below and use --cacert dockhive-db-ca.pem instead.
TLS is on and required by default for every engine except Oracle.
-
sslmode=require(PostgreSQL) orssl-mode=REQUIRED(MySQL) encrypts the connection. -
To also verify the server’s identity, download DockHive’s database CA certificate and use full verification (for example
sslmode=verify-full&sslrootcert=dockhive-db-ca.pem):Terminal window curl -o dockhive-db-ca.pem https://gw.dockhive.sh/api/v1/databases/tls/ca.pemIf this returns 404, your region’s database certificates are publicly trusted: use your system’s CA store.
Turn TLS off
Section titled “Turn TLS off”In the database’s Settings tab, switch Force SSL Connections off and click Update Settings.
- PostgreSQL, MySQL and MariaDB keep offering TLS, but also accept plain connections.
- Redis and RabbitMQ switch to plain connections only (use
redis://andamqp://).
The database restarts briefly to apply the change; your data is kept. We recommend leaving TLS on.
Passwords
Section titled “Passwords”The password is shown in the console whenever you open the database. It can’t be changed yet, so keep it out of your code and share it through environment variables.