Connect your database (SQL & MongoDB)
Connect PostgreSQL, MySQL or MongoDB with a read-only user so the assistant can answer from your live products, prices and stock.
HiveChat answers customer questions from your own database. You connect it once with a read-only user; the assistant can read the tables you choose and can never change anything.
Supported databases: PostgreSQL, MySQL / MariaDB and MongoDB (including Atlas and mongodb+srv://).
Create a read-only user
Never paste your admin login. Create a user that can only read the tables the assistant needs.
-- PostgreSQL
CREATE USER hivechat_ro WITH PASSWORD 'a-long-random-password';
GRANT USAGE ON SCHEMA public TO hivechat_ro;
GRANT SELECT ON public.products TO hivechat_ro;
-- MySQL / MariaDB
CREATE USER 'hivechat_ro'@'%' IDENTIFIED BY 'a-long-random-password';
GRANT SELECT ON shop.products TO 'hivechat_ro'@'%';
For MongoDB create a user with the built-in read role on the one database. HiveChat refuses any user that can write, insert, update or delete.
Connect and scan
- Open Data sources → Connect database.
- Paste the connection URL, for example
postgresql://hivechat_ro:password@db.example.com:5432/shop?sslmode=require. - Click Connect & scan. We list the tables or collections the user can see and highlight the ones that look like products.
The database must be reachable from the internet and use TLS. Private addresses (localhost, 10.x, 192.168.x) are blocked on purpose.
Choose what the assistant may read
For every table or collection you tick, map the columns:
- Name / title (required) and Price, Stock, ID / SKU, Description, Image URL (optional).
- Search columns: the customer's words are matched against these.
- Order / product link: a template such as
https://myshop.com/product/{id}. The assistant shares this link when a customer wants to buy.
Click Save & test. A source only answers customers once it shows OK and Read-only verified.
Preview what the assistant reads
Use Preview to type a customer question and see the exact rows, prices and order links the assistant would use. This is also the best way to tune your search columns.
How it stays safe
- Queries are built by our backend from your mapping. The AI never writes SQL.
- Everything runs in read-only mode with row and time limits.
- Only rows matching the customer's question are shown to the AI.
- The connection URL is write-only and stored encrypted.
- Remove the source at any time and the assistant stops reading it immediately.
Was this guide helpful?