> ## Documentation Index
> Fetch the complete documentation index at: https://docs.mora.com/llms.txt
> Use this file to discover all available pages before exploring further.

# PostgreSQL

> Connect Mora to a PostgreSQL database.

## Prerequisites

* A PostgreSQL server reachable from the internet (or through your network configuration).
* A database user with read access to the schemas and tables you want to query.

## Required fields

| Field | Description | Example |
| - | - | - |
| **Name** | A display name for this datasource in Mora. | `Mora warehouse` |
| **Host** | The hostname or IP address of your PostgreSQL server. | `localhost` |
| **Port** | The port PostgreSQL is listening on. | `5432` |
| **Database** | The name of the database to connect to. | `my_database` |
| **User** | The database user. | `admin` |
| **Password** | The user's password. | |

## Optional fields

| Field | Description |
| - | - |
| **SSL** | Enable SSL for encrypted connections. Turn this on if your server requires or supports TLS. |

## Steps

1. Open **Settings → Datasources → New**.
2. Enter a name and select **PostgreSQL** as the type.
3. Fill in the fields above.
4. Click **Test connection** to verify Mora can reach your database.
5. Click **Create**.

## Troubleshooting

* **Connection refused**: Confirm the host, port, and that your firewall allows inbound connections from Mora's IP.
* **Authentication failed**: Double-check the user and password. Ensure the user has `CONNECT` privilege on the database.
* **SSL required**: Toggle the SSL switch on and retry.

## Related

* [Catalog sync](/datasources/catalog), how Mora discovers your schemas and tables.
* [Managing datasources](/datasources/manage), edit, re-test, or delete.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.