Aspire.Hosting.MySql 13.6.4

Prefix Reserved
dotnet add package Aspire.Hosting.MySql --version 13.6.4
                    
NuGet\Install-Package Aspire.Hosting.MySql -Version 13.6.4
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Aspire.Hosting.MySql" Version="13.6.4" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Aspire.Hosting.MySql" Version="13.6.4" />
                    
Directory.Packages.props
<PackageReference Include="Aspire.Hosting.MySql" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Aspire.Hosting.MySql --version 13.6.4
                    
#r "nuget: Aspire.Hosting.MySql, 13.6.4"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Aspire.Hosting.MySql@13.6.4
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Aspire.Hosting.MySql&version=13.6.4
                    
Install as a Cake Addin
#tool nuget:?package=Aspire.Hosting.MySql&version=13.6.4
                    
Install as a Cake Tool

MySQL hosting integration

Use this integration to model, configure, and orchestrate a MySQL resource in an Aspire solution.

Getting started

Add the integration

From your AppHost directory, add the Aspire.Hosting.MySql integration with the Aspire CLI:

aspire add Aspire.Hosting.MySql

Usage example

In the AppHost, add a MySQL resource and reference it from another resource with either C# or TypeScript:

C#

var db = builder.AddMySql("mysql").AddDatabase("mydb");

var myService = builder.AddProject<Projects.MyService>()
                       .WithReference(db);

TypeScript

const db = await builder.addMySql("mysql").addDatabase("mydb");

const myService = await builder.addNodeApp("myService", "../my-service", "server.js")
                       .withReference(db);

MySQL REPL

Call WithRepl() to opt into a REPL command on the MySQL server resource in the dashboard:

builder.AddMySql("mysql").WithRepl();
await builder.addMySql("mysql").withRepl();

REPL access is disabled by default and is available only in run mode. Enable it only for trusted dashboard users: the shell uses the resource's configured credentials and is not read-only. Sharing the dashboard through a tunnel, Codespaces, or VS Code remote development also exposes this capability to users who can execute resource commands.

Use quit before closing the terminal tab to end the session cleanly. Closing the tab alone can leave mysql running inside the container. Stopping the container also ends any remaining REPL processes.

When the container is running, the command opens the bundled mysql client in the terminal dock, authenticated as root with the resource's configured password. No local MySQL client installation is required.

The password is passed through an environment variable, not command-line arguments or SQL history. The command uses the configured Docker or Podman runtime and is not added in publish mode.

Connection Properties

When you reference a MySQL resource using WithReference, the following connection properties are made available to the consuming project:

MySQL server

The MySQL server resource exposes the following connection properties:

Property Name Description
Host The hostname or IP address of the MySQL server
Port The port number the MySQL server is listening on
Username The username for authentication
Password The password for authentication
Uri The connection URI, with the format mysql://root:{Password}@{Host}:{Port}
JdbcConnectionString The JDBC connection string for MySQL, with the format jdbc:mysql://{Host}:{Port}. User and password credentials are provided as separate Username and Password properties.

MySQL database

The MySQL database resource combines the server properties above and adds the following connection properties:

Property Name Description
DatabaseName The MySQL database name
Uri The database-specific URI, with the format mysql://root:{Password}@{Host}:{Port}/{DatabaseName}
JdbcConnectionString The database-specific JDBC connection string, with the format jdbc:mysql://{Host}:{Port}/{DatabaseName}. User and password credentials are provided as separate Username and Password properties.

Aspire exposes each property as an environment variable named [RESOURCE]_[PROPERTY]. For instance, the Uri property of a resource called db1 becomes DB1_URI.

Additional documentation

Feedback & contributing

https://github.com/microsoft/aspire

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (10)

Showing the top 5 NuGet packages that depend on Aspire.Hosting.MySql:

Package Downloads
CommunityToolkit.Aspire.Hosting.MySql.Extensions

An Aspire hosting integration for extending MySQL resources with additional management tooling.

Shiny.DocumentDb.Aspire.Hosting

.NET Aspire AppHost integration for Shiny.DocumentDb — model a document store as a resource, pick its backend (Postgres/SQL Server/MySQL/SQLite), and gate seeding. JIT-only (Aspire hosting is reflection-heavy).

Shiny.Aspire.Orleans.Hosting

Package Description

Nextended.Aspire.Hosting.DbTools

Database tools for an Aspire app host. The first: fill a database resource from a database that already exists — schema and data — from another resource in the stack or from a server it does not model. PostgreSQL, SQL Server, MySQL/MariaDB, MongoDB and Redis, each through its own engine's dump and restore tools.

Girvs.Aspire.Hosting

Package Description

GitHub repositories (8)

Showing the top 8 popular GitHub repositories that depend on Aspire.Hosting.MySql:

Repository Stars
bitfoundation/bitplatform
Build all of your apps using what you already know and love ❤️
microsoft/aspire-samples
Browse the sample apps demonstrating Aspire integration across C#, JavaScript, TypeScript, Python, Go, containers, databases, cloud, AI, and observability scenarios.
NexusForever/NexusForever
An emulator for the defunct MMORPG WildStar which supports build 16042 (Final Patch)
CommunityToolkit/Aspire
A community project with additional components and extensions for Aspire
AAEmu/AAEmu
A server software for ArcheAge written in .Net C#
formcms/formcms
AI Agent: Open-source headless CMS built with ASP.NET Core (C#) and React, featuring REST APIs, GraphQL, and a GrapesJS page designer.
amasen02/freshcart-backend
FreshCart — .NET 10 + Aspire microservices reference e-commerce platform with an Angular 20 SPA
PacktPublishing/Pragmatic-Microservices-with-CSharp-and-Azure
Pragmatic Microservices with C# and Azure, published by Packt
Version Downloads Last Updated
13.6.4 2,820 10/24/2026
13.6.3 1,096 10/21/2026
13.6.2 1,178 10/20/2026
13.6.1 7,281 10/7/2026
13.6.0 6,925 9/29/2026
13.5.4 14,903 9/15/2026
13.5.3 32,285 8/25/2026
13.5.2 4,207 8/21/2026
13.5.1 886 8/20/2026
13.5.0 7,782 8/18/2026
13.4.6 43,483 6/19/2026
13.4.5 7,782 6/17/2026
13.4.4 1,915 6/15/2026
13.4.3 8,024 6/8/2026
13.4.2 11,630 6/3/2026
13.4.1 373 6/3/2026
13.4.0 3,444 6/1/2026
13.3.5 18,974 5/21/2026
13.3.4 906 5/19/2026
13.3.3 6,498 5/15/2026
Loading failed