🐘 PostgreSQL Connection

Connect your PostgreSQL database to Meza AI.

Overview

Connect your PostgreSQL database to Meza AI to sync your customer data. PostgreSQL is one of the most popular databases for B2B SaaS applications, and Meza AI supports all modern PostgreSQL versions.

Prerequisites

  • PostgreSQL 10 or higher
  • Database credentials with read access
  • Network access to the database (whitelist Meza AI IPs if needed)

Connection Steps

1

Navigate to Databases

Go to ConfigurationDatabases in the left sidebar.

2

Add New Connection

Click Add Connection and select PostgreSQL from the list.

3

Enter Connection Details

Fill in the required connection parameters (see table below).

4

Test Connection

Click Test Connection to verify the settings work correctly.

5

Save

Click Save to complete the setup. Your database is now connected!

Connection Parameters

ParameterDescriptionExample
HostDatabase server hostname or IP addressdb.example.com
PortPostgreSQL port (default: 5432)5432
DatabaseName of the database to connect tomyapp_production
UsernameDatabase username with read accessmeza_readonly
PasswordPassword for the database user********
SSL ModeSSL connection mode (require, verify-full, etc.)require

⚠️ Warning

We strongly recommend creating a dedicated read-only database user for Meza AI. This follows the principle of least privilege and ensures Meza AI cannot modify your data.

Creating a Read-Only User

Run these SQL commands to create a read-only user for Meza AI:

-- Create the user
CREATE USER meza_readonly WITH PASSWORD 'your_secure_password';

-- Grant connect privilege
GRANT CONNECT ON DATABASE your_database TO meza_readonly;

-- Grant usage on schema
GRANT USAGE ON SCHEMA public TO meza_readonly;

-- Grant select on all tables
GRANT SELECT ON ALL TABLES IN SCHEMA public TO meza_readonly;

-- Grant select on future tables
ALTER DEFAULT PRIVILEGES IN SCHEMA public 
GRANT SELECT ON TABLES TO meza_readonly;

Whitelisting Meza AI IPs

If your database is behind a firewall, whitelist these Meza AI IP addresses:

34.102.136.180
35.247.10.205

For AWS RDS, add these IPs to your security group inbound rules on port 5432. For Google Cloud SQL, add them to your authorized networks.

SSL Configuration

We recommend using SSL for all database connections. Common SSL modes:

ModeDescription
requireRequire SSL connection (recommended)
verify-caRequire SSL and verify server certificate
verify-fullRequire SSL, verify certificate, and verify hostname
disableNo SSL (not recommended for production)

✅ Tip

If your database is in a private network, consider using an SSH tunnel for secure access.

Troubleshooting

Connection Timeout

If the connection times out, check that:

  • Meza AI IPs are whitelisted in your firewall
  • The database server is accessible from the internet
  • The port (usually 5432) is open

Authentication Failed

If authentication fails, verify that:

  • Username and password are correct
  • The user has CONNECT privilege on the database
  • pg_hba.conf allows connections from Meza AI IPs

What's Next?