# MySqlServerResource

- Module: [Aspire.Hosting.MySql](/reference/api/typescript/aspire.hosting.mysql.md)
- Version: `13.4.0`
- Kind: `handle`
- Source: [GitHub](https://github.com/microsoft/aspire)

A resource that represents a MySQL container.

## Definition

```typescript
interface MySqlServerResource
  extends IComputeResource,
    IExpressionValue,
    IManifestExpressionProvider,
    IResource,
    IResourceWithArgs,
    IResourceWithConnectionString,
    IResourceWithEndpoints,
    IResourceWithEnvironment,
    IResourceWithProbes,
    IResourceWithWaitSupport,
    IValueProvider,
    IValueWithReferences {
  readonly connectionStringExpression: ReferenceExpression;
  readonly databases: Dict<string,string>;
  readonly host: EndpointReferenceExpression;
  readonly jdbcConnectionString: ReferenceExpression;
  passwordParameter: ParameterResource;
  readonly port: EndpointReferenceExpression;
  readonly primaryEndpoint: EndpointReference;
  readonly uriExpression: ReferenceExpression;
  addDatabase(
      name: string,
      databaseName?: string): MySqlDatabaseResource;
  withDataBindMount(
      source: string,
      isReadOnly?: boolean): MySqlServerResource;
  withDataVolume(
      name?: string,
      isReadOnly?: boolean): MySqlServerResource;
  withInitFiles(source: string): MySqlServerResource;
  withPassword(password: ParameterResource): MySqlServerResource;
  withPhpMyAdmin(configureContainer?: (obj: PhpMyAdminContainerResource) => Promise<void>, containerName?: string): MySqlServerResource;
}
```

## Properties

- `connectionStringExpression`: `ReferenceExpression` `get` -- Gets the connection string expression for the MySQL server.
- `databases`: `Dict<string,string>` `get` -- A dictionary where the key is the resource name and the value is the database name.
- `host`: `EndpointReferenceExpression` `get` -- Gets the host endpoint reference for this resource.
- `jdbcConnectionString`: `ReferenceExpression` `get` -- Gets the JDBC connection string for the MySQL server.
- `passwordParameter`: `ParameterResource` `get - set` -- Gets or sets the parameter that contains the MySQL server password.
- `port`: `EndpointReferenceExpression` `get` -- Gets the port endpoint reference for this resource.
- `primaryEndpoint`: `EndpointReference` `get` -- Gets the primary endpoint for the MySQL server.
- `uriExpression`: `ReferenceExpression` `get` -- Gets the connection URI expression for the MySQL server.

## Methods

- [addDatabase](/reference/api/typescript/aspire.hosting.mysql/mysqlserverresource/adddatabase.md) -- `method` -- Adds a MySQL database to the application model.
    ```typescript
  addDatabase(name: string, databaseName?: string): MySqlDatabaseResource
  ```
- [withDataBindMount](/reference/api/typescript/aspire.hosting.mysql/mysqlserverresource/withdatabindmount.md) -- `method` -- Adds a bind mount for the data folder to a MySql container resource.
    ```typescript
  withDataBindMount(source: string, isReadOnly?: boolean): MySqlServerResource
  ```
- [withDataVolume](/reference/api/typescript/aspire.hosting.mysql/mysqlserverresource/withdatavolume.md) -- `method` -- Adds a named volume for the data folder to a MySql container resource.
    ```typescript
  withDataVolume(name?: string, isReadOnly?: boolean): MySqlServerResource
  ```
- [withInitFiles](/reference/api/typescript/aspire.hosting.mysql/mysqlserverresource/withinitfiles.md) -- `method` -- Copies init files into a MySql container resource.
    ```typescript
  withInitFiles(source: string): MySqlServerResource
  ```
- [withPassword](/reference/api/typescript/aspire.hosting.mysql/mysqlserverresource/withpassword.md) -- `method` -- Configures the password that the MySQL resource uses.
    ```typescript
  withPassword(password: ParameterResource): MySqlServerResource
  ```
- [withPhpMyAdmin](/reference/api/typescript/aspire.hosting.mysql/mysqlserverresource/withphpmyadmin.md) -- `method` -- Adds a phpMyAdmin administration and development platform for MySql to the application model.
    ```typescript
  withPhpMyAdmin(configureContainer?: (obj: PhpMyAdminContainerResource) => Promise<void>, containerName?: string): MySqlServerResource
  ```
