cloudflare · Cloudflare Workers Docs
Index Connect to a MySQL database with Cloudflare Workers
A step-by-step tutorial for building a Cloudflare Worker that connects to a MySQL database using Hyperdrive and TCP Sockets.
Derived skill
Files assembled from official documentation
Viewing SKILL.md
Index Connect to a MySQL database with Cloudflare Workers
A step-by-step tutorial for building a Cloudflare Worker that connects to a MySQL database using Hyperdrive and TCP Sockets.
When To Use
Use when you need to implement a workflow to connect a Cloudflare Worker to a remote MySQL database using Hyperdrive for optimized performance.
Reference Files
| File | Contains | Use For |
|---|---|---|
SKILL.md | Entry point: scope, routing table, and workflow. | Start here. |
docs/workers-mysql-index-connect-to-a-database-with-cloudflare-workflow-guide.md | A tutorial guide for creating a Cloudflare Workers application that connects to a MySQL database using TCP Sockets and Hyperdrive. | Questions about a tutorial guide for creating a Cloudflare Workers application that connects to a MySQL database using TCP Sockets an... |
examples/workers-mysql-index-connect-to-a-database-with-cloudflare-cloudflare-wor.text | A step-by-step guide and command sequence for initializing a Cloudflare Workers project to connect to a MySQL database. | Exact payloads, commands, or snippets shown in A step-by-step guide and command sequence for initializing a Cloudflare Workers project to connect to a MySQL database. |
examples/workers-mysql-index-connect-to-a-database-with-cloudflare-cloudflare-wor-2.text | The shell commands required to initialize the MySQL tutorial project using the Cloudflare create command. | Exact payloads, commands, or snippets shown in The shell commands required to initialize the MySQL tutorial project using the Cloudflare create command. |
examples/workers-mysql-index-connect-to-a-database-with-cloudflare-cloudflare-wor-3.text | The shell commands required to initialize the MySQL tutorial project using the Cloudflare create command. | Exact payloads, commands, or snippets shown in The shell commands required to initialize the MySQL tutorial project using the Cloudflare create command. |
examples/workers-mysql-index-connect-to-a-database-with-cloudflare-cloudflare-wor-4.text | A text-based guide outlining the initial steps and directory setup for connecting Cloudflare Workers to a MySQL database. | Exact payloads, commands, or snippets shown in A text-based guide outlining the initial steps and directory setup for connecting Cloudflare Workers to a MySQL datab... |
examples/workers-mysql-index-connect-to-a-database-with-cloudflare-cloudflare-wor-5.text | A configuration file demonstrating the compatibility flags and settings required to connect Cloudflare Workers to a MySQL database. | Exact payloads, commands, or snippets shown in A configuration file demonstrating the compatibility flags and settings required to connect Cloudflare Workers to a M... |
examples/workers-mysql-index-connect-to-a-database-with-cloudflare-cloudflare-wor-6.text | A configuration text file specifying nodejs_compat compatibility flags and a compatibility date for connecting Cloudflare Workers to a MySQL database. | Exact payloads, commands, or snippets shown in A configuration text file specifying nodejscompat compatibility flags and a compatibility date for connecting Cloudfl... |
examples/workers-mysql-index-connect-to-a-database-with-cloudflare-cloudflare-wor-7.text | A command line instruction using wrangler to create a Hyperdrive configuration with a MySQL connection string. | Exact payloads, commands, or snippets shown in A command line instruction using wrangler to create a Hyperdrive configuration with a MySQL connection string. |
examples/workers-mysql-index-connect-to-a-database-with-cloudflare-cloudflare-wor-8.text | A wrangler.toml configuration file demonstrating how to bind a Hyperdrive instance to a Cloudflare Worker for MySQL connectivity. | Exact payloads, commands, or snippets shown in A wrangler.toml configuration file demonstrating how to bind a Hyperdrive instance to a Cloudflare Worker for MySQL c... |
examples/workers-mysql-index-connect-to-a-database-with-cloudflare-cloudflare-wor-9.text | A wrangler.toml configuration file demonstrating how to bind a Hyperdrive instance to a Cloudflare Worker for MySQL connectivity. | Exact payloads, commands, or snippets shown in A wrangler.toml configuration file demonstrating how to bind a Hyperdrive instance to a Cloudflare Worker for MySQL c... |
examples/workers-mysql-index-connect-to-a-database-with-cloudflare-cloudflare-wor-10.text | A text-based guide outlining the steps to connect a Cloudflare Worker to a MySQL database using the mysql2 library. | Exact payloads, commands, or snippets shown in A text-based guide outlining the steps to connect a Cloudflare Worker to a MySQL database using the mysql2 library. |
examples/workers-mysql-index-connect-to-a-database-with-cloudflare-cloudflare-wor-11.text | A tutorial guide for connecting Cloudflare Workers to a MySQL database using the mysql2 library. | Exact payloads, commands, or snippets shown in A tutorial guide for connecting Cloudflare Workers to a MySQL database using the mysql2 library. |
examples/workers-mysql-index-connect-to-a-database-with-cloudflare-cloudflare-wor-12.text | The shell commands required to install the mysql2 dependency using pnpm for a Cloudflare Workers project. | Exact payloads, commands, or snippets shown in The shell commands required to install the mysql2 dependency using pnpm for a Cloudflare Workers project. |
examples/workers-mysql-index-connect-to-a-database-with-cloudflare-cloudflare-wor-13.text | A command to install the mysql2 package using the Bun package manager for connecting Cloudflare Workers to a MySQL database. | Exact payloads, commands, or snippets shown in A command to install the mysql2 package using the Bun package manager for connecting Cloudflare Workers to a MySQL da... |
examples/workers-mysql-index-connect-to-a-database-with-cloudflare-cloudflare-wor-14.text | A configuration snippet for Cloudflare Workers using Hyperdrive and nodejscompat to connect to a MySQL database. | Exact payloads, commands, or snippets shown in A configuration snippet for Cloudflare Workers using Hyperdrive and nodejscompat to connect to a MySQL database. |
examples/workers-mysql-index-connect-to-a-database-with-cloudflare-cloudflare-wor-15.text | A configuration file setting nodejs_compat compatibility flags and a Hyperdrive binding for connecting Cloudflare Workers to a MySQL database. | Exact payloads, commands, or snippets shown in A configuration file setting nodejscompat compatibility flags and a Hyperdrive binding for connecting Cloudflare Work... |
examples/workers-mysql-index-connect-to-a-database-with-cloudflare-cloudflare-wor-16.text | A Node.js code example demonstrating how to connect to a MySQL database using Cloudflare Workers and Hyperdrive via the mysql2 library. | Exact payloads, commands, or snippets shown in A Node.js code example demonstrating how to connect to a MySQL database using Cloudflare Workers and Hyperdrive via t... |
examples/workers-mysql-index-connect-to-a-database-with-cloudflare-cloudflare-wor-17.text | A step-by-step guide and command sequence for connecting a Cloudflare Worker to a MySQL database using Wrangler. | Exact payloads, commands, or snippets shown in A step-by-step guide and command sequence for connecting a Cloudflare Worker to a MySQL database using Wrangler. |
What This Skill Covers
- In this tutorial, you will learn how to create a Cloudflare Workers application and connect it to a MySQL database using TCP Sockets and Hyperdrive. The Work...
- Main sections:
Tags,Prerequisites,1\. Create a Worker application,2\. Enable Node.js compatibility,3\. Create a Hyperdrive configuration.
Workflow
- Open the most relevant file under
docs/for the exact documented workflow and wording. - Open
schemas/files for exact structured contracts. - Open
examples/files for concrete requests, commands, snippets, and manifests. - Do not add behavior or configuration that is not present in the attached source files.
Canonical source: https://developers.cloudflare.com/workers/tutorials/mysql/index.md
