---
docId: doc_2f0b3da90058419688c518a47450340c
title: 'Connect a database'
description: 'Connect PostgreSQL or MySQL, test access and enable read-only queries for your agent.'
---

# Connect a database

Your agent can query PostgreSQL or MySQL to answer questions about orders, products or appointments. The connection allows read-only queries, and you can [choose the available tables and columns](/help/integrations/functions/tables).

Open **Integrations → Functions → Database**.

<span id="lo-que-protege-platica"></span>
<span id="antes-de-empezar"></span>


![Database connection settings](/images/screenshots/manuales-piloto/integraciones/pantallas-completas/en/base-de-datos.webp)

## Prepare access

Have the host, port, database, user and SSL mode ready. Use a database user with read access only to the necessary data. The destination must be public: Platic rejects local and private addresses.

You need Integrations access. Storing a password or selecting one from the vault also requires the corresponding [Secrets](/help/integrations/functions/secrets) permissions.

<span id="connecting-a-database"></span>
<span id="if-you-use-supabase"></span>
<span id="ssl"></span>
<span id="conectar-una-base"></span>
<span id="si-usas-supabase"></span>

## Create the connection

1. Click **New connection**.
2. Enter a **Name** of up to 32 characters, using lowercase letters, numbers and underscores.
3. Complete **Engine**, **Host**, **Port**, **Database**, **User** and **SSL**. **Paste connection string** can fill these fields.
4. Enter the password or choose an existing secret. Leave it blank only if the database user does not need a password.
5. Add a brief description of the data and when to query it.
6. Click **Create and test**.

The connection is saved and access is tested. If the test fails, the connection may already exist: fix the error in its editor before creating another one.

**Required** encrypts the connection; **Verify certificate** also checks the server certificate. **No SSL** sends the connection without encryption.

For Supabase, if the direct destination only provides IPv6 and cannot connect, try the **Session pooler** settings. Keep the SSL mode your provider requires.

<span id="what-the-agent-gets"></span>
<span id="lo-que-recibe-el-agente"></span>
<span id="comprobar-el-acceso"></span>
<span id="darle-la-conexión-a-un-agente"></span>

## Test and assign tools

In **Test your database**, enter a `SELECT` query and click **Run**. The panel uses the saved connection and rules: click **Save** before testing pending changes.

Queries allow a single read statement. If more rows are available, request the next page. Each page queries the database again, so data can change between pages. A query with a defined order makes results easier to review.

In **Agents**, link the required tools: list tables, describe columns, query and request the next page. You can also do this from the agent's [Tools](/help/agents/tools). Tool links apply separately from publishing instructions.

<span id="the-password"></span>
<span id="la-contraseña"></span>

## Change the password or pause access

The password is encrypted in Secrets and is not shown again in the editor. **Change** lets you select another secret or enter a new password; this applies immediately, without waiting for the editor's Save button.

If you change the destination and see **Authorize again**, complete that authorization. Rotating a secret changes its stored value; it does not change the password at the database provider.

**Pause** disables agent tools and preserves the connection. Manual tests may remain available depending on your permissions; pausing does not cancel queries already in progress.

<span id="what-platica-protects"></span>
<span id="limits"></span>
<span id="common-errors"></span>
<span id="do-it-through-the-api-or-from-your-assistant"></span>
<span id="límites"></span>
<span id="errores-comunes"></span>
<span id="hazlo-por-api-o-desde-tu-asistente"></span>
<span id="siguiente-paso"></span>

## Limits and errors

In **Limits**, adjust rows per page and query time: initially 50 rows and 5 seconds, with maximums of 200 rows and 30 seconds. The pagination cursor lasts 30 minutes; rerun the query if it expires.

When an error appears, check credentials and authorization, host and internet access, SSL or table permissions. For slow queries, request less data or adjust the timeout.

**Logs** show the operation, status, duration and counts. They may include SQL text, up to 4,000 characters, but do not store result rows.

Continue with [Tables and columns](/help/integrations/functions/tables). You can also read the [API connection guide](/guides/connect-a-database).
