How to Configure Codex MariaDB Credentials
You set up codex mariadb credentials by creating a read-only database user first. Then you pass those secret values to the coding agent workspace. Many engineering teams start by sharing a broad admin user for speed. That shortcut lets an automated agent drop tables or read private rows. A bad prompt can also expose those static passwords in plain text logs. How to set up codex mariadb credentials Start inside your MariaDB server by making a dedicated account for the agent. Do not reuse a hum
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 codex mariadb credentials by creating a read-only database user first. Then you pass those secret values to the coding agent workspace. Many engineering teams start by sharing a broad admin user for speed. That shortcut lets an automated agent drop tables or read private rows. A bad prompt can also expose those static passwords in plain text logs.
How to set up codex mariadb credentials
Start inside your MariaDB server by making a dedicated account for the agent. Do not reuse a human developer login or an app service account. Grant this new account read rights on only the tables it needs. Leave out write, delete, and schema change rights unless a task requires them. Next, bind the account to the specific network host where the agent runs. This stops outsiders from using the login if the password leaks later.
Once the database role is ready, store the username and password safely. Put them into the secret store that your agent workspace reads at startup. Never write database passwords inside source code files or prompt templates. The coding agent reads these values from its runtime variables when it runs. It then opens a standard client session to MariaDB to inspect schemas. If the agent uses a local shell tool, require human approval for commands. That step keeps the agent from running database scripts without your review.
What native MariaDB roles solve and what keeps the session active
Native MariaDB user rules do a great job of blocking bad logins. They also stop a read-only user from running delete or drop statements. Setting table permissions is a vital first step for any engineering team. Still, database grants only check who logs in at the start. They do not inspect the actual queries that run during an active session.
A read-only role still lets the agent pull thousands of sensitive customer rows. If a table holds emails, phone numbers, or card numbers, queries return them. Those raw values then flow straight into the model context window. Also, shared static passwords sit on disk or in memory for weeks. If you share one role across a team, your audit logs suffer. Every query looks the same in the MariaDB log. You cannot tell which engineer or agent session ran a heavy query. Teams also struggle to rotate these stored passwords across many developer machines.
Ephemeral Credentials + End-to-End Encryption: architecture patterns and best practices
Continue reading? Get the full guide.
Free. No spam. Unsubscribe anytime.
Best practices for ongoing credential hygiene
Review the database grants for your AI tools every few weeks. Remove access to tables that the project no longer touches. Set strict query time limits on the MariaDB account to stop slow scans. Rotate the stored password on a set schedule and after team changes. Keep production data out of reach when an agent only needs test schemas. Separate accounts for each workspace also make it easier to revoke a key.
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, inline in the MySQL wire protocol. On every query an AI agent or human runs against production MySQL, RDS, or Aurora, hoop.dev decides to pass, mask, block, or hold it for review.
Multi-statement batches and prepared queries are split and checked one by one by hoop.dev guardrails, which refuse banned queries with a native MySQL error or hold risky ones for approval. On the response path, hoop.dev data masking rewrites string values in returned rows in memory, and every decision is logged. See the MIT-licensed project on GitHub.
Frequently asked questions
Should an AI coding agent use a read-only MariaDB user?
Yes, always start with a read-only database role for any coding agent. This prevents accidental data changes or table drops when the agent tests queries.
Where should teams store MariaDB passwords for coding agents?
Store passwords in your workspace secret manager or local runtime variables. Never put raw database keys into git files, shared notes, or chat prompts.
Why are read-only grants not enough for production databases?
Read-only grants still return sensitive fields like emails, phone numbers, and national IDs. Without result masking, those private values go straight into the model prompt context.
Related guides
In this post