DocsConnect your data
Connect a database
Create a user that can only read, allow Adea's addresses and connect. Steps for PostgreSQL, MySQL, MariaDB, Redshift, BigQuery and Snowflake.
On this page
Adea needs one thing from your database: a user that can only read. You create it, give Adea the details, and Adea starts reading. It takes about five minutes.
If you don’t run the database yourself, send the person who does the developer link. They connect it without an account.
If you work with an AI agent like Claude Code, it can do all of this for you. See Let your AI agent connect it below.
Before you start
- Use a read replica if you have one. Adea runs one query at a time on each connection, and holds back when your database is busy. A replica keeps that load off your main database.
- Adea must be able to reach the database, either directly from the internet or through an SSH server you control. Adea connects only to public addresses, never straight into a private network. If yours is private, see If your database isn’t reachable from the internet below.
- Use SSL if your database supports it.
- Have the host, the port and the database name ready.
Allow Adea’s addresses
If your database sits behind a firewall or an allowlist, you allow Adea’s addresses there. When you add the database in Adea, the connect screen shows them with a copy button. Adea reaches your database from those and from nowhere else, and they are the same for every company. If you are setting this up for someone else, the developer link you send from Adea shows them too.
Create the read-only user
Choose your kind of database. Replace your_database, the other your_ names and the password with your own, and use a long password.
PostgreSQL
CREATE USER adea_readonly WITH PASSWORD 'choose-a-long-password';
GRANT CONNECT ON DATABASE your_database TO adea_readonly;
GRANT USAGE ON SCHEMA public TO adea_readonly;
GRANT SELECT ON ALL TABLES IN SCHEMA public TO adea_readonly;
ALTER DEFAULT PRIVILEGES IN SCHEMA public
GRANT SELECT ON TABLES TO adea_readonly;
If your tables are not in the public schema, repeat the schema lines for each schema Adea should read.
MySQL and MariaDB
The same statements work on both.
CREATE USER 'adea_readonly'@'%' IDENTIFIED BY 'choose-a-long-password';
GRANT SELECT, SHOW VIEW ON your_database.* TO 'adea_readonly'@'%';
FLUSH PRIVILEGES;
Amazon Redshift
CREATE USER adea_readonly PASSWORD 'choose-a-long-password';
GRANT USAGE ON SCHEMA public TO adea_readonly;
GRANT SELECT ON ALL TABLES IN SCHEMA public TO adea_readonly;
ALTER DEFAULT PRIVILEGES IN SCHEMA public
GRANT SELECT ON TABLES TO adea_readonly;
BigQuery
BigQuery has no users with passwords. You create a service account that can run queries and view data, and give Adea its key.
gcloud iam service-accounts create adea-readonly --project=your-project \
--display-name="Adea (read-only)"
gcloud projects add-iam-policy-binding your-project --role=roles/bigquery.jobUser \
--member=serviceAccount:adea-readonly@your-project.iam.gserviceaccount.com
gcloud projects add-iam-policy-binding your-project --role=roles/bigquery.dataViewer \
--member=serviceAccount:adea-readonly@your-project.iam.gserviceaccount.com
gcloud iam service-accounts keys create adea-key.json \
--iam-account=adea-readonly@your-project.iam.gserviceaccount.com
Adea checks that the key cannot write to any dataset, and refuses one that can. Before every query, Adea asks BigQuery how much data it would read, and refuses a query above the limit per query or per month. A question can’t run up your BigQuery bill.
Snowflake
CREATE ROLE adea_readonly;
GRANT USAGE ON WAREHOUSE your_warehouse TO ROLE adea_readonly;
GRANT USAGE ON DATABASE your_database TO ROLE adea_readonly;
GRANT USAGE ON ALL SCHEMAS IN DATABASE your_database TO ROLE adea_readonly;
GRANT USAGE ON FUTURE SCHEMAS IN DATABASE your_database TO ROLE adea_readonly;
GRANT SELECT ON ALL TABLES IN DATABASE your_database TO ROLE adea_readonly;
GRANT SELECT ON ALL VIEWS IN DATABASE your_database TO ROLE adea_readonly;
GRANT SELECT ON FUTURE TABLES IN DATABASE your_database TO ROLE adea_readonly;
GRANT SELECT ON FUTURE VIEWS IN DATABASE your_database TO ROLE adea_readonly;
CREATE USER adea_readonly TYPE = SERVICE DEFAULT_ROLE = adea_readonly
DEFAULT_WAREHOUSE = your_warehouse RSA_PUBLIC_KEY = 'paste-the-public-key';
GRANT ROLE adea_readonly TO USER adea_readonly;
Adea signs in with a key pair. Generate the pair, put the public key in the user as above, and give Adea the private key.
Connect it in Adea
- Open Data and choose to add a source.
- Choose the kind of database and enter the details, or paste a connection string.
- Adea tests the connection one step at a time: it reaches the database, signs in, checks that the user can only read, and reads the list of tables. Each step turns green. If one fails, Adea says what to fix.
- Adea reads the names of your tables and columns, and starts learning what they mean.
If your database isn’t reachable from the internet
Careful teams keep the database on the server itself (127.0.0.1), on a private network, or in Docker with its port published only on the server. Don’t open the database’s port to the internet for Adea. Let Adea come in through SSH instead. Adea signs in to a server of yours with a key it makes for this one connection, and forwards from there to the database. Only SSH has to be reachable, and the key can do nothing else. This works for PostgreSQL, MySQL, MariaDB and Redshift.
-
Make a user just for Adea on the server, with no shell and no password:
sudo useradd --create-home --shell /bin/false adea-tunnel sudo usermod -p '*' adea-tunnel -
Limit what that user can do. Add this to
/etc/ssh/sshd_config, with the database’s address as your server sees it, then runsudo sshd -t && sudo systemctl reload ssh:Match User adea-tunnel AllowTcpForwarding local PermitOpen 127.0.0.1:5432 X11Forwarding no AllowAgentForwarding no PermitTTY no PasswordAuthentication no ForceCommand /bin/false -
If SSH sits behind a firewall, allow only Adea’s addresses to the SSH port, and nothing else. The connect screen shows them with a copy button.
-
In Adea, open Data, choose to add a source, pick the database and paste the connection string. Switch on Connect through SSH and enter the server, its port and the SSH user. In the connection string, give the database as your server sees it, like
127.0.0.1:5432. Press Test and connect. -
Add Adea’s key. The first test stops at Reach your server over SSH, because the key isn’t on the server yet. Adea shows the key and one command to run on the server as the SSH user. It adds a line that lets the key forward to this one database, and do nothing else. Run it, then test again.
-
Check the server’s key. At the first successful test Adea saves the server’s host key and shows its fingerprint on the connection. Compare it with the one the server prints for
ssh-keygen -lf /etc/ssh/ssh_host_ed25519_key.pub. If the server’s key ever changes, Adea stops and asks you before it trusts the new one.
The database has to let the read-only user in from your server. For a Docker database that is usually the server’s own address or Docker’s bridge address, which pg_hba.conf in PostgreSQL or the user’s host in MySQL decides.
Let your AI agent connect it
An AI agent connected to your company over MCP can connect the database for you, with the developer or administrator role you gave it.
- It asks you first, in one sentence: Adea gets read-only access, and can read the data but never change it.
- When you say yes, it makes the read-only user above and allows Adea’s addresses in your firewall. Adea gives it both. If the database isn’t open to the internet, it never opens the port: it makes the locked-down SSH user from the section above instead, and adds Adea’s public key to it.
- It connects the database, and Adea tests it step by step like any other. A user that can write is refused.
- Adea mails you that your agent connected the database, with a link to disconnect it.
The agent made the user, so it already knows the password. Adea stores it encrypted and never shows it again, never writes it to a log, and never sends it to its own AI models.
What Adea reads, and what it keeps
Adea does not keep a copy of your database. It reads what a question needs, works out the answer and drops the rows. Each query runs in its own short-lived process that holds only that one connection.
Every query is checked before it runs. Only a single read is allowed, and Adea refuses anything that could change data. Guardian looks at every pull of data on top of that.
If it doesn’t connect
| What you see | What to do |
|---|---|
| Adea can’t reach the database | Check the host and port, and that the addresses Adea shows are allowed in your firewall. |
| The test stops at “Reach your server over SSH” | Adea can’t reach the SSH server (check the address, the port and that your firewall lets Adea’s addresses in), or the server doesn’t accept Adea’s key yet (run the command Adea shows, as the SSH user), or the server’s host key changed. |
| The SSH step passes but the next step fails | The server won’t forward to the database, or can’t reach it. Check AllowTcpForwarding and PermitOpen, and the database’s address as your server sees it. |
| Adea says the user can write | Adea refuses a user that can change data. Create the user as shown above and take away any other rights. |
| Sign-in fails | Check the user name and password. In MySQL and MariaDB the user must be allowed from any host ('%'). In PostgreSQL the user must be allowed to connect from outside your network. |
| Adea connects but sees no tables | Give the user SELECT on the schema that holds your tables, as in the examples above. |
| Questions are slow | Connect a read replica instead of your main database. |
Still stuck? Write to hello@adea.app. A person answers.