How to Configure Goose MySQL Read Only Access
You set up goose mysql read only access by creating a restricted database user. Then you pass those limited credentials to your local agent extension. Engineering teams often connect AI agents to databases to debug errors fast. Many developers reuse their own admin database credentials to save setup time. If an agent uses an admin role, one bad prompt can delete production tables. Broad roles also let the model pull huge amounts of customer data at once. How to set up goose mysql read only acc
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 goose mysql read only access by creating a restricted database user. Then you pass those limited credentials to your local agent extension. Engineering teams often connect AI agents to databases to debug errors fast. Many developers reuse their own admin database credentials to save setup time. If an agent uses an admin role, one bad prompt can delete production tables. Broad roles also let the model pull huge amounts of customer data at once.
How to set up goose mysql read only access natively
Setting up safe database permissions starts inside your MySQL server. A database admin creates a new user account just for the AI agent. The admin grants only select permissions on specific schemas or tables. They leave out insert, update, delete, and drop rights for that user. This ensures the database engine blocks any attempt to change or remove rows.
Next, the developer configures the local Goose agent on their machine. The agent uses extensions to talk to outside tools and databases. The developer puts the new MySQL host, user, and password into the local config. When the user asks a question, the agent writes a SQL query. The extension logs into MySQL with the restricted role and runs the statement. MySQL checks the role rules and returns the matching rows to the agent.
What native read-only roles solve and what they miss
Native MySQL roles do a great job of stopping data changes. If the AI agent tries to drop a table, MySQL rejects the query. The database enforces this rule every time the agent sends a command. This protects your tables from accidental edits or destructive mistakes during a chat.
Still, a read-only role only checks who logs in and what tables they read. It does not check what happens inside each query while it runs. An agent with select rights on a customer table can still read sensitive columns. The query results might include emails, phone numbers, card numbers, or national IDs. The agent sends those raw results straight to an external model provider. Data masking solves this by rewriting matched fields in results before they return.
Static database users also force teams to store plain passwords on developer laptops. Anyone or any script on that machine can read the local config file. If a laptop gets lost, teams must rotate that shared password across every machine. Native roles also lack clear logs that tie an AI query to a person. The database log only shows the shared agent account, not the engineer driving it. Finally, a bad select query with big joins can still lock up production CPU.
Auditor Read-Only Access + MySQL Access Governance: architecture patterns and best practices
Continue reading? Get the full guide.
Free. No spam. Unsubscribe anytime.
Why local agent credentials create audit gaps
Auditors want to know which person read sensitive records and when they did it. When five engineers share one read-only login for their agents, audit trails break. The database records five identical sessions under the same static username. Security teams cannot tell if a human or an automated prompt ran a query.
Giving each developer a separate agent account adds heavy upkeep for database admins. Admins must create, track, and delete dozens of extra users across every database server. When someone leaves the team, admins must hunt down and revoke every local login. Without central controls, old keys stay active on laptops for months.
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 a MySQL read-only user still slow down a production database?
Yes, a read-only user can run heavy queries that scan millions of rows. You should pair read-only roles with query timeouts or read replicas to protect performance.
Does a read-only database role protect sensitive customer fields?
No, select rights on a table allow the user to read every column inside by default. To hide emails or card numbers, you need views or dynamic data masking.
Where does the Goose agent store database passwords by default?
Local agents usually read credentials from environment variables or local config files on disk. Keeping long-lived passwords on laptops increases the risk of accidental leaks.
Related guides
In this post