MySQL MCP server security and permissions

Which controls limit what an AI agent can read and change through a MySQL MCP server, and which of them are documented by the community servers versus Oracle.

On this page

Does the MySQL MCP server security model meet our database access requirement?

Access control for a MySQL MCP server is not a single built-in feature of any MySQL edition. It is enforced by the MySQL accounts and grants your organization creates, combined with the settings of whichever server you choose, either Oracle's MySQL MCP server in the oracle/mcp repository or a community server. No edition should be assumed to provide role-based control at the MCP layer, so the approval question is really whether your database grants and server configuration together match the access you intend to give an agent.

The sources document different levels of control. The community designcomputer/mysql_mcp_server SECURITY.md tells you to create a dedicated MySQL user with minimal permissions, never to use root or an administrative account, and offers a SELECT-only grant for exploration or a grant adding INSERT, UPDATE, DELETE and CREATE TEMPORARY TABLES for data changes without structural changes. It also suggests per-user limits such as MAX_QUERIES_PER_HOUR, column-level grants, views and host restrictions. The community benborla/mcp-server-mysql sample .env adds separate switches for write and DDL operations, schema-specific permissions and rate and complexity limits, with writes defaulting to false. Confirm which of these controls the Oracle server exposes in its own README before assuming parity.

Your review should answer three questions: which account the agent will use, which grants that account holds on each schema and table, and whether the server's own switches are set to match. Treat multi-database mode with writes enabled as a finding unless schema-specific permissions are in place, because the benborla sample warns against it. Ask the vendor or maintainer to confirm how the server behaves when a grant is missing, and test that behavior against a non-production database before approving use on live data.

Which MySQL MCP server controls are documented, and by which server

This table lists the access controls each MySQL MCP server documents, one control per row. Where a cell says to confirm in the README, treat that control as unverified until the vendor or repository documents it. The main takeaway is that the community servers document more server-side switches, while the MySQL user's grants remain the control you can verify directly in any setup.

Controloracle/mcp MySQL serverdesigncomputer/mysql_mcp_server (community)benborla/mcp-server-mysql (community)
Read-only enforcementNot documented. Confirm in the README.Read-only grant limited to SELECT, shown as the recommended exploration setup.Write switches default to false in the sample .env file.
Write switches (INSERT, UPDATE, DELETE, DDL)Not documented. Confirm in the README.Set by MySQL grants: the standard grant adds INSERT, UPDATE, DELETE and CREATE TEMPORARY TABLES, but no structural changes.Separate switches for INSERT, UPDATE, DELETE and DDL in the sample .env file.
Schema-specific permissionsNot documented. Confirm in the README.Not listed as a server setting. Scope the MySQL user's grants to the schemas needed.Schema-specific permission settings exist. Allowing writes in multi-database mode without them is not recommended.
Per-user hourly query and update limitsNot documented. Confirm in the README.Set MAX_QUERIES_PER_HOUR and MAX_UPDATES_PER_HOUR on the MySQL user.Not listed in the sample .env file. Confirm in the README.
Column-level SELECT grants and viewsNot documented. Confirm in the README.Suggested: column-level SELECT grants and VIEWs to limit exposed data.Not listed in the sample .env file. Confirm in the README.
Host restrictionNot documented. Confirm in the README.Restrict the MySQL user to specific hosts instead of wildcards.Not listed in the sample .env file. Confirm in the README.
Query rate limit and complexity limitsNot documented. Confirm in the README.Not documented. Confirm in the README.MYSQL_RATE_LIMIT and MYSQL_MAX_QUERY_COMPLEXITY settings are listed.
Query timeoutNot documented. Confirm in the README.Not documented. Confirm in the README.A query timeout setting is listed in the sample .env file.

Where MySQL enforces what the MCP server may do

MySQL grants are the enforcement point that holds even when the MCP server is misconfigured. An AI agent reaches the database through three layers: the MCP client the staff member runs (such as Claude Code or Cursor), the MCP server process that translates tool calls into SQL, and the MySQL account the server logs in with. Only the last layer is controlled by the database itself. Server settings and client approval prompts can be changed, bypassed or widened by whoever runs the process, but the account's privileges decide what MySQL will actually execute. Before approving any community server, confirm which MySQL user it connects as and list that user's grants on each schema it can see.

The community designcomputer project's SECURITY.md centers its guidance on that account. It tells operators to create a dedicated MySQL user with minimal permissions for the MCP server and never to use the root account or any user with full administrative privileges. The same file describes the grant levels it treats as appropriate: a read-only setup limited to SELECT for exploration, and a standard setup that adds data changes but not structural ones. It also points to per-user limits on queries and updates per hour, column-level SELECT grants, views and host restrictions instead of wildcard hosts. These are database-side controls, so they hold regardless of what the client sends.

The community benborla server takes a different route, with switches in its .env file for INSERT, UPDATE, DELETE and DDL operations, schema-specific permission settings, and limits such as MYSQL_RATE_LIMIT and query timeouts. Its sample file states that write permissions default to false for safety and warns against enabling writes in multi-database mode without schema-specific permissions. Treat these switches as a useful second layer, not the primary control. A switch set to true in a shared config file widens access without any change to the database account, so the grant review should still be done in MySQL and recorded for the reviewer.

Three permission tiers the designcomputer guidance describes

The designcomputer SECURITY.md guidance sorts MySQL MCP access into tiers, from read-only exploration to data changes without schema changes. Each tier maps to a different decision about what an agent may touch, and the controls around the tiers (narrower grants, hourly limits, host restrictions and a ban on privileged accounts) decide how much damage a misused agent can do.

Read-only SELECT for exploration

The guidance recommends a grant limited to SELECT as the starting point for exploring a database. This tier answers one question: may the agent see data at all? An agent on this grant can read schemas and rows but cannot alter them, so it suits analysis, debugging and reporting work. Confirm that the account has no write privileges through SHOW GRANTS before the connection is used, and retest after any grant change.

Read the SECURITY.md

Standard data-change grant

The second tier grants SELECT, INSERT, UPDATE, DELETE and CREATE TEMPORARY TABLES. It lets the agent change rows but not the structure of the database. The decision here is whether the workflow truly needs row changes. Because DELETE and UPDATE can affect many rows in one statement, reviewers should confirm which tables are in scope and whether the business accepts agent-driven edits to them.

Column-level grants and views

The guidance suggests column-level SELECT grants and VIEWs to narrow what the agent can see inside a table. This decides whether sensitive fields such as personal identifiers, credentials or financial values are exposed at all. A view can present only approved columns and filtered rows, while column grants block direct access to the underlying table. Test each view with the MCP account, since a view that exposes a restricted column defeats the purpose.

Per-user hourly limits

MySQL per-user limits such as MAX_QUERIES_PER_HOUR and MAX_UPDATES_PER_HOUR cap how much work the MCP account can perform. This affects the blast radius of a runaway or manipulated agent, since a looping process hits the cap instead of running unchecked. Ask the database team to set limits that fit normal workload, and check that the limits are not so high that they provide no protection.

Host-specific accounts, not wildcards

The guidance advises restricting the MCP user to specific hosts instead of wildcard hosts. A user defined for any host can connect from anywhere the network allows, while a host-bound account can only connect from the machine or subnet where the agent runs. Reviewers should confirm the host value in the account definition matches the actual client location, and that the account cannot be reused from other networks.

No root or full-admin accounts

The guidance states that the MCP server should never use the root account or any user with full administrative privileges. This is the boundary every other tier depends on. An agent connected as an administrator can alter grants, drop schemas and read every table, which makes the narrower tiers meaningless. Before rollout, check that the account lacks administrative privileges and that no shared credential with broader rights is stored in the agent configuration.

How the answer changes by server and database layout

When the agent only needs to explore one schema and answer questions, a read-only account is the simplest control to defend. The designcomputer/mysql_mcp_server SECURITY.md describes a read-only grant limited to SELECT as the recommended setup for exploration, and it advises a dedicated MySQL user rather than root or any account with administrative privileges.

  • Dedicated user: Create one MySQL account for the MCP server and grant SELECT only on the schema it needs.
  • Column-level grants: Where tables hold personal or financial fields, grant SELECT on the non-sensitive columns only.
  • Views: Expose a curated view instead of base tables so the agent never sees raw sensitive rows.
  • Host restriction: Bind the account to specific client hosts instead of wildcards.
  • Per-user limits: Consider MAX_QUERIES_PER_HOUR to cap how much the agent can read.

Confirm that the grant is actually read-only by testing an INSERT with the account, and confirm which server build you run, since grant behavior is set in MySQL, not in the MCP server.

Order of work before an AI agent reaches production data

This sequence moves an MySQL MCP server from an unreviewed connection to one whose permissions have been tested and recorded, so the approving team can see what the agent can and cannot do before it touches production data.

  1. Choose the server and confirm its documented controls

    The security or platform lead picks the server first, because the controls available depend on the project. Oracle's MySQL MCP server lives in the oracle/mcp repository and is the vendor-built option, while the designcomputer and benborla servers are community projects with their own documented settings. Read each README and SECURITY file, then write down which controls the chosen server documents: database grants, per-user limits, schema-specific write switches, rate limits and query timeouts. Confirm with the vendor or project which of these you can rely on for your version. The step is done when the team has a one-page list of documented controls and an approved server choice.

  2. Create a dedicated account for each use case

    A database administrator creates a separate MySQL user for each agent use case, such as exploration, reporting or a supervised write workflow. The community designcomputer project says to use a dedicated user with minimal permissions and never the root account or any user with full administrative privileges, so the account should hold no administrative rights at all. Each account gets its own name so that its activity can be traced in database logs. The step is done when the team can list every agent account, its purpose, and confirm that none of them has global or administrative privileges.

  3. Apply grants and views and test that writes and DDL fail

    The database administrator assigns the narrowest grants that fit each use case. The designcomputer SECURITY.md describes a read-only grant limited to SELECT for exploration, and a standard grant of SELECT, INSERT, UPDATE, DELETE and CREATE TEMPORARY TABLES that permits data changes but not structural changes. Where possible, add column-level SELECT grants or views so sensitive columns are hidden. Then run a test session under each account that attempts an INSERT, an UPDATE, a DELETE and a CREATE TABLE against a non-critical table, and confirm each attempt is refused by MySQL itself. The step is done when every blocked operation is recorded with its error result.

  4. Set hourly limits and host restrictions

    The database administrator sets per-user limits such as MAX_QUERIES_PER_HOUR and MAX_UPDATES_PER_HOUR, which the designcomputer SECURITY.md suggests, so a runaway agent loop has a ceiling. The same account is tied to specific client hosts rather than wildcard hosts, so the agent can connect only from the machine or gateway that the team approved. Confirm the limit values with the team that owns the database, since the right numbers depend on normal workload. The step is done when the account settings show the chosen limits and host restrictions, and a connection attempt from an unapproved host is refused.

  5. Configure server switches and timeouts

    The team sets the server's own controls in its configuration file. The benborla sample .env file has separate switches for INSERT, UPDATE, DELETE and DDL operations, and the comment states that write permissions default to false for safety, so the team should confirm each switch is off unless a use case needs it. The same file lists MYSQL_RATE_LIMIT, MYSQL_MAX_QUERY_COMPLEXITY and query timeout settings, and warns against allowing writes in multi-database mode without schema-specific permissions. Set each value explicitly and record the file version. The step is done when a reviewer can compare the configuration file against the approved settings and find no unexplained differences.

  6. Verify with a negative test that the agent cannot exceed its grants

    A security engineer runs a negative test through the actual MCP client that the agent will use, not only through a direct database session. The tester asks the agent for operations outside its grants, including writes on a read-only account, DDL, access to a restricted column or schema, and queries that exceed the timeout or the hourly limit. Each attempt should fail at the database or at the server, and the failure should appear in the logs. Note any case where the agent succeeds and fix it before approval. The step is done when every negative case has a recorded expected result and a recorded actual result that matches.

  7. Record the configuration as evidence

    The security or compliance lead stores the evidence package in a version-controlled location. It should include the server choice and version, the list of documented controls, the account list with grants and views, the host and hourly limit settings, the server configuration with timestamps, and the negative test results with the date each test ran. Assign an owner for re-running the negative tests after any change to the server, the grants or the client. The step is done when the package can be handed to an approver or auditor without further explanation, and the re-test owner is named.

Gaps the community server docs do not close

The community MySQL MCP server documentation describes useful database-side controls, but it does not describe approval gates, central policy or full audit trails for agent activity. The cards below cover what remains open after the grants, limits and sample settings are in place, and the usual ways organizations close each gap.

No documented approval for each tool call

The supplied community sources do not describe a step where a person approves each individual tool call before the agent runs it. Write permissions are controlled by the account grants and the server's own switches, not by a per-query review. Before rollout, confirm in the server code and your own tests whether any confirmation step exists. If none does, limit the connection to read-only accounts for exploration and keep write-capable accounts to narrow, named tables that a reviewer has approved.

SECURITY.md

Prompt injection can still trigger allowed actions

An agent that reads table contents, comments or documents may follow instructions hidden in that data. If the MySQL account allows SELECT on a sensitive column or INSERT, UPDATE or DELETE on a business table, an injected instruction can use those rights within the granted scope. Grants limit the damage but do not stop the instruction from being followed. Test the setup with planted instructions in sample rows, and keep sensitive columns out of the granted view.

sample .env

Agent query audit depends on your MySQL logging

The community sources do not describe a built-in audit trail of agent queries. Whatever record exists depends on the MySQL logging the organization enables, such as the general query log or audit plugin your edition supports, and on retaining those logs outside the database host. Ask the database team which statements are recorded, under which account, and for how long. Tie each MCP account to a single identity so that log entries can be traced back to one agent configuration.

SECURITY.md

Database credentials stored in client configuration

The MCP server needs a MySQL username and password, which usually sit in an environment file or the client's configuration. A copy on a developer laptop can be read by any process running as that user, and it can end up in version control or shared screenshots. Store the secret in your organization's secret manager, issue a dedicated account per use case, rotate it on a schedule, and check that the sample .env file pattern is not committed to repositories.

sample .env

Central admin policy is not documented

The supplied community sources do not describe a central console where an administrator can set which MCP servers a client may load, lock permission switches across users, or revoke access at once. Each developer's client settings control the server, the account and the switches. Ask the vendor or maintainers directly, and until a central control is confirmed, review the client configuration of each connected workstation and keep the list of approved servers in a written standard.

server repository

What a security reviewer asks to see for MySQL MCP access

This table lists the evidence a reviewer should request before approving a MySQL MCP server, with what each item proves and where it comes from. Read it as a checklist: each row should be answered from the database, the server configuration, or the client configuration, not from the vendor's general claims. The main takeaway is that a read-only label on the server means little unless the database grants, host restrictions and switch settings all confirm it.

Evidence itemWhat it provesWhere it comes from
Dedicated MySQL account and grant listThe MCP server uses its own user, not root or an administrator, and the grants match the approved access levelDatabase: SHOW GRANTS output for the MCP user
Grant export with no administrative privilegesThe account lacks global privileges such as administrative, process, file or grant rightsDatabase: exported grants for every schema the user can reach
Host restriction evidenceThe user is limited to specific client hosts, with no wildcard host entriesDatabase: the host column of the mysql.user table for the MCP account
Column-level and view-based restrictionsSensitive columns are excluded from SELECT, or the agent reads only through approved viewsDatabase: column grants and view definitions tied to the MCP user
Per-user resource limitsQuery and update volume per hour is capped for the accountDatabase: MAX_QUERIES_PER_HOUR and MAX_UPDATES_PER_HOUR values on the user
Server version and security notes in useThe reviewer knows which release and which SECURITY.md or README controls the deployment relies onServer: installed package version, repository commit, and the project's own security documentation
Write and DDL switch configurationInsert, update, delete and schema change operations are disabled or limited as intendedServer config: .env or launch settings of the MCP server, such as the switches for writes and DDL
Schema scope and multi-database settingsThe agent reaches only approved schemas, and write rights are not enabled across multiple databases without schema rulesServer config: schema-specific permission settings and database selection
Client configuration and approved tool listOnly the intended MCP client and tools are connected, and the agent cannot register other serversClient config: MCP client settings file and its tool allowlist
MySQL general or audit log settingsStatements from the MCP account are recorded with enough detail to attribute agent activityDatabase: general log or audit log configuration, retention period and who can read the logs

Questions buyers ask before approving a MySQL MCP server

Does any MySQL edition add MCP-level role-based access control?

No supplied source documents MCP-level role-based access control in any MySQL edition, so treat it as unconfirmed until Oracle confirms it in writing. The Oracle MySQL MCP server README presents the server as the recommended starting point for MySQL HeatWave or MySQL AI, but the material available here does not describe per-role permission controls inside the server. Ask Oracle or your account team three things: whether any edition offers MCP-specific roles, whether those roles apply to the Oracle server or only to the database, and which edition the answer depends on. Until the answer is in writing, plan access control with MySQL's own accounts and grants, because those apply regardless of which MCP client or server connects.

Is read-only mode enforced by the MCP server or by MySQL?

MySQL grants are the reliable enforcement point. A server-side setting can be misconfigured, changed by a developer, or skipped by a different client, but a MySQL account that holds only SELECT cannot write, whichever client connects. The community designcomputer SECURITY.md recommends a SELECT-only grant for exploration and a standard grant of SELECT, INSERT, UPDATE, DELETE and CREATE TEMPORARY TABLES for data changes without structural changes. Pair grants with per-user limits such as MAX_QUERIES_PER_HOUR and MAX_UPDATES_PER_HOUR, column-level SELECT grants, and views that hide sensitive columns. Then test it: connect as the MCP user and attempt an INSERT, an UPDATE and a CREATE TABLE, and record that each is refused. Server switches are a useful second layer, but the grant is the control you can audit.

What does it cost to run a MySQL MCP server?

The supplied material gives no price for any MySQL MCP server, and the community repositories are open-source projects, so the software license is rarely the main cost. Most of the spend is internal effort: someone designs the MySQL accounts and grants, tests them, documents the connection, and reviews server updates. Recurring costs come from keeping the server current and rerunning grant tests after schema changes. If you use a paid MySQL or HeatWave service, that subscription is a separate line item whose price depends on the service and deployment you choose, so get it from Oracle. Costs rise with the number of databases, schemas and users, and with the number of review cycles. Ask any vendor or consultant for a written quote that states who performs each task, which items are one-time and which recur, which environments are covered, and whether retesting after upgrades is included.

Can our team secure a MySQL MCP server without outside help?

Yes, if your team can write MySQL grants, test them against a non-production database, and keep the results. The core controls are standard database work: dedicated accounts, SELECT-only or limited-write grants, host restrictions in place of wildcards, column grants and views. The harder part is verification. Your team must show that the agent cannot exceed its grants, which means running negative tests as the MCP user and keeping the output for reviewers. It must also check the server's own settings. The benborla sample configuration, for example, sets write switches for INSERT, UPDATE, DELETE and DDL, and its comment says write permissions default to false for safety. If no one on the team has this experience, or if you need an independent test, a security review of the agent setup is a separate scope that DeployOpen performs for AI agent rollouts.

Is a community MySQL MCP server acceptable for production data?

A community server can be acceptable if your review covers its code, its dependencies, its documented controls, and a named owner who keeps it updated. Neither community project in the supplied material is an Oracle or MySQL product. The designcomputer repository describes itself as an MCP server for secure interaction with MySQL databases, and the benborla repository describes read-only access for schema inspection and read-only queries. Check the controls you depend on against the code, not only the description. Confirm whether the server enforces its own read-only setting, whether it works with the per-user grants your database administrator will create, how it stores database credentials, and whether maintainers respond to security reports. Oracle's server is the recommended starting point in its repository and the only one there that supports MySQL AI, so it is the natural baseline to compare against. Where a community server is approved, keep it on a restricted account and a non-production database until the review closes.

What should we ask a vendor or consultant for before approval?

Ask for a written list of controls you can test, with evidence for each one. Request the following:

  • The MySQL account and grant scripts they will create, including a SELECT-only variant and a limited-write variant.
  • Negative test results showing the MCP user is refused on INSERT, UPDATE, DELETE and DDL statements.
  • The server's documented settings for read-only mode, per-user limits and query timeouts, with the exact version you will deploy.
  • Where database credentials are stored, who can read them, and how they rotate.
  • Which logs the server and database keep, where those logs go, and how long they are retained.
  • A retest plan for server upgrades and schema changes.

Confirm each item in writing before work starts, and ask which parts are your responsibility and which are theirs.

Can an outside firm test our MySQL MCP setup before rollout?

Yes. DeployOpen runs AI agent rollout security reviews, before or after an rollout, that test prompt injection, tool and file permissions, data exposure, credential handling, and SSO and admin settings, then deliver a findings report with fixes and a retest. For a MySQL MCP server, the work would focus on the MySQL accounts and grants, the server configuration, the credential path and the negative test results. Engagements are fixed-scope, so the scope, deliverables and timelines are agreed in writing before work starts. DeployOpen does not publish a price list, and a quote follows from that written scope. DeployOpen prepares systems and evidence for compliance assessments but does not issue audit reports or certifications, so independent auditors or certification bodies remain responsible for those decisions.

How DeployOpen tests a MySQL MCP setup before rollout

DeployOpen tests MySQL MCP server security and permissions as a fixed-scope engagement inside your own infrastructure. The work covers the server you pick, the MySQL accounts and grants behind it, and the client settings that decide what an agent can reach.

How we scope

  • Agree in writing which MySQL MCP server is in scope, official Oracle or a named community server
  • Record the MySQL accounts, hosts, schemas and tables the agent is expected to reach
  • Define which tools count as read, write or structural, and which must stay blocked
  • Confirm the deliverables, timeline and retest terms before any testing starts

How we build

  • Create a dedicated MySQL user for the MCP server, separate from root and administrative accounts
  • Test read-only, data-change and structural grants, including column-level SELECT and VIEW restrictions
  • Check per-user limits, host restrictions and the server's own write, DDL and rate settings
  • Run prompt injection attempts that try to reach tables or statements outside the agreed scope

How we hand over

  • Deliver a findings report with severity, evidence and a fix for each gap found
  • Document the final grants, server settings and client configuration so your team can reproduce them
  • Provide a retest after fixes are applied to confirm each finding is closed
  • Hand over the evidence your security and compliance reviewers ask for during approval

How we support

  • Offer ongoing support, upgrades and continuous testing as a retainer after rollout
  • Re-test when the MCP server version, the MySQL schema or agent permissions change
  • Review new tools or community server updates against the agreed scope before they reach staff
  • Keep grant and configuration documentation current as access requirements evolve

Sources and further reading

Talk to our team.

Tell us what you're working on, whether it's a deployment, an audit, a security test or a cyber range. You'll speak with an engineer who can help you scope it.

  • 30-minute call: free, with no obligation.
  • NDA on request: we can sign before you share details.
  • Clear next steps: a scope and plan after the call.