How to Configure OpenHands MariaDB Connect

Published
Length
3 min read

Luis Felipe Dias

All posts

To set up an openhands mariadb connect workflow, give the agent runtime a scoped database role. Then pass your host details into the container workspace. Most teams start by sharing a standard developer login with the coding agent. This quick shortcut creates big risks when the agent runs broad queries. A wide role lets the agent drop tables or read private user data. How the native openhands mariadb connect workflow operates OpenHands runs tasks inside a sandbox container. The agent writes s

Your coding agents run with your access.

Claude Code reaches prod with a developer's credentials, and approval prompts get clicked through. hoop.dev checks every query, masks sensitive data, and holds risky changes for a human.

To set up an openhands mariadb connect workflow, give the agent runtime a scoped database role. Then pass your host details into the container workspace. Most teams start by sharing a standard developer login with the coding agent. This quick shortcut creates big risks when the agent runs broad queries. A wide role lets the agent drop tables or read private user data.

How the native openhands mariadb connect workflow operates

OpenHands runs tasks inside a sandbox container. The agent writes scripts or runs shell tools to talk to your database. To make this work, the sandbox needs network routing to the MariaDB host. It also needs a database user, a password, and a target schema name.

In a standard setup, an admin makes a dedicated MariaDB user for the agent. The admin grants read or write permissions on specific tables. Next, the team puts these login secrets into the agent runtime workspace. When a prompt asks for data checks, the agent reads those stored keys. It opens a standard database session and sends SQL queries over the network.

MariaDB checks the user name and host rules during login. It also checks if the session uses TLS encryption. Once the login passes, the database trusts every query that matches that role.

What native database roles solve and what they miss

Native MariaDB permissions do a good job of blocking unauthorized logins. You can limit the agent to a single schema or block table drops. You can also force TLS so network traffic stays private. For static apps with fixed queries, native database roles work well.

Still, AI coding agents do not run fixed queries. An agent builds new SQL statements on the fly based on prompt context. Native roles only check who logs in and which tables they can touch. They do not inspect what each query does in flight.

End-to-End Encryption: architecture patterns and best practices

Continue reading? Get the full guide.

Free. No spam. Unsubscribe anytime.

If an agent has read access to a customer table, it can pull everything. The agent might read emails, phone numbers, card numbers, or national IDs. Those raw values then flow straight into the model prompt history. Also, a shared static password inside the agent sandbox is easy to leak. A prompt bug can cause the agent to print its own login keys. Finally, database logs only show the shared agent user, not who started the task.

Scoping agent permissions for safer database tasks

Before you connect an autonomous agent to real data, shrink its blast radius. Never give the agent a root account or an admin role. Build a custom role that only reads the exact views needed for the task.

If the agent must test schema changes, point it at an empty test instance. Keep production data out of the sandbox whenever you can. When the agent must query live tables, use strict row limits and timeouts. A bad join from an AI agent can lock up a busy database fast. You should also rotate the database password after each major coding session. Removing static keys from the sandbox stops old containers from making surprise changes later.

Add wire guardrails and masking beside MySQL

Database grants and TLS setup decide who can reach MySQL. Even so, an open session can run broad updates or read raw personal data from allowed tables. In practice, hoop.dev runs beside the database as a sidecar for your MySQL. It keeps your login setup and drivers as they are while checking queries on the wire.

With hoop.dev MySQL support, guardrails refuse bad queries before they run and return a readable MySQL error. Data masking rewrites matched sensitive values in result rows in memory. Furthermore, hoop.dev holds SOC 2 Type II and generates evidence for GDPR, HIPAA, and PCI DSS programs. Read the docs and source on GitHub.

Frequently asked questions

Can OpenHands query MariaDB without storing passwords in the container?

Not with a basic direct setup, because the client tool needs a key. To keep secrets out of the sandbox, you need an external access layer.

What permissions should I grant an AI agent on MariaDB?

Grant read access only on the specific tables needed for the current task. Block write, alter, and drop commands unless the agent runs in a test schema.

How do I keep private data out of agent prompts during SQL tasks?

Use dynamic data masking in front of the database to rewrite sensitive fields. This replaces emails, phone numbers, and card numbers in query results before the agent reads them.

The query runs. The emails stay hidden.