Connect a MySQL or PostgreSQL Database
Connect a MySQL or PostgreSQL database to ChartBrick, run a query, and turn the results into a dataset you can chart.
Start a new dataset
From your workspace sidebar, click New to open the data source picker, then choose Postgres or MySQL.
Enter connection details
If you already have connections, pick one from the Connection dropdown. To add a new one, click New connection and fill in the form:
- Host — your database host (for example
db.example.com). - Port — defaults to
5432for PostgreSQL and3306for MySQL. - Database — the database name.
- User — the database user. Use a read-only user when possible.
- Password — optional; leave blank if your database does not require one.
For PostgreSQL, tick Use SSL connection if your database requires SSL (most cloud-hosted databases do).
Click Save connection. ChartBrick verifies the credentials as it saves and shows an error if it can't connect. The connection is saved to your workspace so you can reuse it next time without re-entering the credentials.
Write your query and import
In the SQL query box, write a SELECT query (for example SELECT * FROM customers). Only SELECT statements are allowed.
Enter a Dataset name and click Import. ChartBrick runs the query, snapshots the rows, and opens the new dataset.
Datasets are a point-in-time snapshot. When your database changes, open the dataset and click Update data to re-run the query and pull the latest rows.
Manage connections
Go to Settings > Connections to see every connection in the workspace. Only workspace admins can manage them — admins can edit or delete each connection from the icons in its row.
Deleting a connection keeps the data in datasets you already created, but they can no longer be updated from the source with Update data. Editing leaves the password unchanged unless you enter a new one.
What's next?
- Connect a Google Sheet — link a spreadsheet instead of a database.
- Upload a CSV file — import data from a file.
- Create your first chart — turn your dataset into a visualization.