How to Configure Windsurf MySQL Least Privilege

Published
Length
3 min read

Luis Felipe Dias

All posts

You set up windsurf mysql least privilege by creating a restricted database user. Then you limit the AI coding agent to read-only queries on safe tables. Teams often give local coding tools root keys for fast testing. Broad database roles let an autonomous agent change rows or drop tables by mistake. On June 2, 2026, Cognition renamed Windsurf to Devin Desktop. The IDE and its core features remain the same. Its Cascade agent runs terminal commands with your permission or uses MCP tools. How wi

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 windsurf mysql least privilege by creating a restricted database user. Then you limit the AI coding agent to read-only queries on safe tables. Teams often give local coding tools root keys for fast testing. Broad database roles let an autonomous agent change rows or drop tables by mistake. On June 2, 2026, Cognition renamed Windsurf to Devin Desktop. The IDE and its core features remain the same. Its Cascade agent runs terminal commands with your permission or uses MCP tools.

How windsurf mysql least privilege works in practice

To lock down database access, you start inside your MySQL server. You create a new database role dedicated to your AI coding agent. You grant this role select rights only on specific schemas and tables. You do not grant drop, delete, alter, or admin rights to this user. Next, you bind this restricted user to a specific network host.

Now you look at how the agent reaches the database. In Devin Desktop, the agent opens a dedicated terminal on your machine. It uses zsh on macOS and bash on Linux. This terminal loads your normal shell files, aliases, and local variables. If you store admin keys in your shell profile, the agent inherits them. The Cascade agent also reaches external systems through Model Context Protocol servers.

To enforce your restricted setup, remove admin database keys from your default shell. Give the MCP server or local shell only the restricted MySQL user credentials. When the agent runs a query, MySQL checks the role rules first. If the agent tries to delete a table, the database blocks the action.

Why native roles leave a runtime gap

Native MySQL permissions decide which user account can log in. They also control which tables and views that user can read. This setup stops destructive writes and schema changes before they happen. It is a vital first step for any team using AI agents.

Still, static database roles cannot inspect individual queries in flight. A read-only user can still pull thousands of customer rows at once. If a table holds emails, phone numbers, or card numbers, the agent reads them. That raw data then goes to the model provider in the prompt context. You also cannot ask a human to approve just one risky query. Every query under that database role gets the exact same treatment.

Least Privilege Principle + MySQL Access Governance: architecture patterns and best practices

Continue reading? Get the full guide.

Free. No spam. Unsubscribe anytime.

Scoping agent sessions and shell variables

Because the agent loads your shell startup files, local secrets need care. Developers often keep staging or production keys in local config files for convenience. When the agent runs a command with user permission, those keys are live. You should split your human shell setup from the agent work setup.

Keep separate database roles for human engineers and automated coding agents. Rotate the agent keys often and turn off unused accounts right away. You can also create specific MySQL views that leave out secret columns. Grant the agent role access only to those safe views, not base tables. This shrinks the data footprint the agent can reach during coding sessions.

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

Did Windsurf change its name to Devin Desktop?

Yes, Cognition renamed Windsurf to Devin Desktop on June 2, 2026. It keeps the same IDE features, and old docs links now redirect there.

How does the agent reach my MySQL database?

The agent runs commands in a dedicated zsh or bash terminal with user permission. It also uses configured MCP servers to talk to external systems like MySQL.

Can a read-only MySQL role still expose sensitive data?

Yes, a read-only role still lets queries return emails, phone numbers, and card numbers. To stop this, use restricted views or rewrite matched fields in query results.

The query runs. The emails stay hidden.