How to Configure OpenHands MariaDB Permissions
You set up openhands mariadb permissions by creating a dedicated database account with narrow privileges. Then you pass those login credentials to the agent runtime container. Most teams start by giving their AI agent full database rights to move fast. Broad roles let an autonomous agent drop tables, alter schemas, or read private customer records. How openhands mariadb permissions work in practice OpenHands runs tasks inside an isolated workspace container to write code and fix bugs. When th
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.
You set up openhands mariadb permissions by creating a dedicated database account with narrow privileges. Then you pass those login credentials to the agent runtime container. Most teams start by giving their AI agent full database rights to move fast. Broad roles let an autonomous agent drop tables, alter schemas, or read private customer records.
How openhands mariadb permissions work in practice
OpenHands runs tasks inside an isolated workspace container to write code and fix bugs. When the agent needs database context, it opens a network session to MariaDB. MariaDB checks the incoming account name, the source host, and the secret password. Next, the database engine reads its internal grant tables to check allowed actions.
Good setup starts with a dedicated database user built just for the agent. Admins bind this user to the specific IP range of the agent container. You can grant read rights on target schemas instead of the whole server. If the agent only checks data shapes, it just needs schema inspection rights. If it must test migrations, you grant write rights on a scratch database only.
MariaDB also supports role assignments to group these rules together for easier upkeep. An admin creates a role for AI coding tools and attaches table rules. Even with table grants, column grants help restrict sensitive fields from broad queries. You can also set per-account limits on queries per hour and open connections. These account caps stop a runaway agent loop from taking down the database server.
Why static database roles leave an operational gap
Native MariaDB grants do a great job of blocking unauthorized network logins. They also draw a clear line between read accounts and write accounts. Still, static grants only check who logs in and which tables they touch. They cannot judge the intent or safety of a query while it runs.
An AI agent with read access on a user table can pull every row by default. If that table holds emails, phone numbers, or card numbers, the model gets them. Native permissions either block the whole column or send the raw text back. They do not rewrite matched fields in results before the agent reads the output.
AI Agent Permissions + End-to-End Encryption: architecture patterns and best practices
Continue reading? Get the full guide.
Free. No spam. Unsubscribe anytime.
Static roles also struggle when an agent needs temporary write access for one task. Leaving write rights on all day invites bad deletes from a confused prompt. Revoking and granting roles by hand for each ticket slows the whole team down. Also, standard database logs only show the shared agent account name on queries. Teams cannot easily trace which developer prompt triggered a heavy query in MariaDB.
Scoping agent database tasks by workflow
Start by splitting agent workflows into read tasks and schema change tasks. For bug research, give the agent read rights on non-sensitive tables only. Leave out tables that store user secrets, billing data, or national IDs. Use database views to expose safe subsets of rows when table rules feel too blunt.
For code tasks that write data, point OpenHands at a local test instance. Never give an autonomous container direct write grants on a live production schema. Rotate the agent password often and clear out idle database accounts every week. Review query logs each week to spot strange table scans from agent runs.
Check MySQL queries and results on the wire
MySQL grants control who logs in. They do not check single queries or mask sensitive columns once a session starts. With hoop.dev, you run an open-source proxy, a sidecar for your MySQL. It runs next to MySQL, RDS, or Aurora and reads the MySQL wire protocol.
Multi-statement batches and prepared queries are split and checked one by one by hoop.dev guardrails. When a rule refuses a query, MySQL returns a native error packet with your message. On the response path, hoop.dev data masking rewrites string values in returned rows that match your rules. Every query and decision is logged per resource. See the MIT-licensed project on GitHub.
Frequently asked questions
What database rights does an OpenHands agent actually need?
Most coding agents only need read rights on app schemas to inspect table structures. Grant write privileges only on disposable test databases during automated test runs.
Can MariaDB roles hide sensitive columns from AI agents?
MariaDB supports column-level grants, so you can allow reads on safe columns only. Still, queries that select all columns will fail instead of masking sensitive fields.
How do we stop an OpenHands loop from overloading MariaDB?
Set resource limits on the MariaDB account used by the agent container. Cap queries per hour and max concurrent connections so bad loops fail fast.
Related guides
In this post