-
Notifications
You must be signed in to change notification settings - Fork 10.2k
[Hyperdrive] MySQL for Hyperdrive changelog announcement #21351
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 4 commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
8681161
thomasgauvin: MySQL for Hyperdrive announcement
thomasgauvin d29ead5
Apply suggestions from code review
Oxyjun 97c7fba
Update src/content/changelog/hyperdrive/2025-04-08-hyperdrive-mysql-s…
thomasgauvin b2ac3a5
adjust per pr comments
thomasgauvin c894a44
fix snippet issue
thomasgauvin 4bb2138
remove unnecessary file
thomasgauvin b9f2fd7
nit to mysql support
thomasgauvin 588e756
Update src/content/changelog/hyperdrive/2025-04-08-hyperdrive-mysql-s…
thomasgauvin File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
21 changes: 21 additions & 0 deletions
21
src/content/changelog/hyperdrive/2025-04-08-hyperdrive-mysql-support.mdx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| --- | ||
| title: Hyperdrive introduces support for MySQL and MySQL-compatible databases | ||
| description: You can now connect to MySQL databases from your Workers using Hyperdrive for optimal performance | ||
| products: | ||
| - hyperdrive | ||
| date: 2025-04-08T14:00:00Z | ||
| --- | ||
|
|
||
| import { Code } from "~/components"; | ||
|
|
||
| Hyperdrive now supports connecting to MySQL and MySQL-compatible databases, including Amazon RDS MySQL, Google Cloud SQL for MySQL, Azure Database for MySQL, and PlanetScale. | ||
|
|
||
| Hyperdrive makes your regional, MySQL databases fast when connecting from Cloudflare Workers. It eliminates unnecessary network roundtrips during connection setup, pools database connections globally, and can cache query results to provide the fastest possible response times. | ||
|
|
||
| Best of all, you can connect using your existing drivers, ORMs, and query builders with Hyperdrive's secure credentials, no code changes required. | ||
thomasgauvin marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| import mysqlRaw from "~/content/partials/hyperdrive/mysql-snippet-slim.mdx?raw"; | ||
|
|
||
| <Code code={mysqlRaw} lang="typescript" /> | ||
thomasgauvin marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| Learn more about [how Hyperdrive works](/hyperdrive/configuration/how-hyperdrive-works/) and [get started building Workers that connect to MySQL with Hyperdrive](/hyperdrive/get-started/). | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,29 @@ | ||
| import { createConnection } from "mysql2/promise"; | ||
|
|
||
| export interface Env { | ||
| HYPERDRIVE: Hyperdrive; | ||
| } | ||
|
|
||
| export default { | ||
| async fetch(request, env, ctx): Promise<Response> { | ||
| const connection = await createConnection({ | ||
| host: env.HYPERDRIVE.host, | ||
| user: env.HYPERDRIVE.user, | ||
| password: env.HYPERDRIVE.password, | ||
| database: env.HYPERDRIVE.database, | ||
| port: env.HYPERDRIVE.port, | ||
| disableEval: true, // Required for Workers compatibility | ||
| }); | ||
|
|
||
| const [results, fields] = await connection.query("SHOW tables;"); | ||
|
|
||
| ctx.waitUntil(connection.end()); | ||
|
|
||
| return new Response(JSON.stringify({ results, fields }), { | ||
| headers: { | ||
| "Content-Type": "application/json", | ||
| "Access-Control-Allow-Origin": "*", | ||
| }, | ||
| }); | ||
|
|
||
| }} satisfies ExportedHandler<Env>; |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.