Prompt Buddy logoPrompt Buddy

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.

Import to Prompt Buddy

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

FileContainsUse For
SKILL.mdEntry point: scope, routing table, and workflow.Start here.
docs/workers-mysql-index-connect-to-a-database-with-cloudflare-workflow-guide.mdA 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.textA 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.textThe 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.textThe 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.textA 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.textA 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.textA 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.textA 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.textA 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.textA 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.textA 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.textA 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.textThe 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.textA 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.textA 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.textA 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.textA 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.textA 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

  1. Open the most relevant file under docs/ for the exact documented workflow and wording.
  2. Open schemas/ files for exact structured contracts.
  3. Open examples/ files for concrete requests, commands, snippets, and manifests.
  4. 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