Can Grok query MySQL? Yes, through a hosted MCP connector
Grok can't run local MCP servers, so dbhub and similar MySQL servers won't work. Query MySQL from Grok over MCP with Contextflo and a read-only user.
Jump to a section
Grok can query MySQL, but not with the usual local MCP servers. Grok connectors need a server on the public internet. Contextflo is the hosted route: connect MySQL once with a read-only user, then add one URL to Grok.
MySQL often sits behind an app or a store, and the people with questions about orders or signups are not the ones writing SQL. Asking in Grok is a natural fit. The setup just has to be hosted.
Option 1: a MySQL MCP server in Grok
The common option is @bytebase/dbhub, which supports MySQL. You start it with npx and a DSN, ideally pointed at a replica.
That makes it a stdio server on your own machine. Grok can't run local servers and can't reach localhost, so it doesn't work as a Grok connector. If you expose it publicly yourself, you are now hosting a service that holds database credentials, which is more than a chat question calls for.
Option 2: Contextflo
On the MySQL side, create a read-only user:
Loading code sample...
Point Contextflo at a replica if you have one.
In Contextflo: go to Data Sources, then Add data source, and pick MySQL. Enter host, port, username and password. SSL is on by default, and an SSH bastion is optional for private databases. Pick the tables to expose and invite your team.
In Grok:
- Open grok.com/connectors.
- Choose New Connector, then Custom.
- Enter
https://mcp.contextflo.com/mcp. - Complete the sign-in.
Each person signs in with their own Contextflo account. Contextflo runs SELECT only.
What a bare connection leaves out
Application databases have cryptic names and no descriptions. Contextflo generates table and column descriptions, and your team saves corrections and definitions as shared context. You choose which tables each person can query. You get an audit trail of prompts and the SQL that ran, and a weekly digest.
Which one to use
For Grok, the hosted route is the one that works. Local MySQL servers are fine in clients that can launch processes on your machine, but Grok is not one of them.
You do the modeling, we do the rest. Connect MySQL free.
FAQ
Can Grok connect to MySQL?
Yes, through a hosted MCP server. Grok connectors only reach servers on the public internet, so a local MySQL MCP server won't work. Contextflo connects to MySQL and gives Grok one URL.
Why doesn't dbhub work in Grok?
@bytebase/dbhub supports MySQL, but it runs as a local stdio process with a DSN. Grok can't run local servers or reach localhost.
What does Contextflo need to connect to MySQL?
A host, port, username and password. SSL is on by default, and you can connect through an SSH bastion if the database is private.
Is it safe to point this at a production MySQL database?
Use a read-only user with SELECT on the schema you expose, and point it at a replica if you have one. Contextflo runs SELECT only.