# Connect to your database

> The host, port, user and password on the Connect tab, the CA certificate for TLS, and examples for psql, mysql and your code.

Source: https://docs.phluit.com/products/managed-databases/connect-to-your-database/

## Your connection details

Open your database in the portal and go to the **Connect** tab.

| Setting | Value |
| --- | --- |
| Host | `dataflow1.phluit.net` (Falkenstein) or `dataflow2.phluit.net` (Helsinki) |
| Port | Each database has its own port, shown on the tab |
| User | `dbadmin` |
| Database | `defaultdb` |
| Password | Click **Show** and confirm it's you |

Your computer or server must be on the database's [trusted sources](/products/managed-databases/trusted-sources/).

## Encryption (TLS)

Connections always use TLS. Download the **CA certificate** (`ca-certificate.crt`) on the **Connect** tab and verify the server with it:

- PostgreSQL: `sslmode=verify-ca sslrootcert=ca-certificate.crt`
- MySQL: `--ssl-mode=VERIFY_CA --ssl-ca=ca-certificate.crt`

Use `verify-ca`, not `verify-full` or `VERIFY_IDENTITY`: the certificate names the database's internal host, not the address you connect to.

## Examples

```sh
# PostgreSQL
PGPASSWORD="$DB_PASSWORD" psql "host=HOST port=PORT user=dbadmin dbname=defaultdb sslmode=verify-ca sslrootcert=ca-certificate.crt"

# MySQL
MYSQL_PWD="$DB_PASSWORD" mysql -h HOST -P PORT -u dbadmin --ssl-mode=VERIFY_CA --ssl-ca=ca-certificate.crt defaultdb
```

The **Connect** tab also has a connection string and ready-made snippets for your code. Keep the password in an environment variable, never in your code.

Tools such as DBeaver, pgAdmin, TablePlus and MySQL Workbench work with the same details.

## Users and databases

`dbadmin` can create databases, users and grants. Give your app its own user with only the rights it needs. There is no superuser.

- **PostgreSQL:** add extensions such as pgvector, pg_stat_statements, uuid-ossp, pgcrypto, citext and hstore with `CREATE EXTENSION`. PostGIS isn't available.
- **MySQL:** every table needs a primary key.

If something doesn't connect, see [Connection errors](/products/managed-databases/connection-errors/).
