Skip to content

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.

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.

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.

PostgreSQL
psql "host=HOST port=PORT user=USER dbname=DBNAME sslmode=require"
MySQL
mysql -h HOST -P PORT -u USER -p DBNAME --ssl-mode=REQUIRED
MariaDB
mariadb -h HOST -P PORT -u USER -p DBNAME --ssl
Redis
redis-cli -h HOST -p PORT --tls --insecure --askpass

Redis 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) or ssl-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.pem

    If this returns 404, your region’s database certificates are publicly trusted: use your system’s CA store.

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:// and amqp://).

The database restarts briefly to apply the change; your data is kept. We recommend leaving TLS on.

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.