Database management

You can add and remove databases, as well as view information about them.

Getting a list of cluster databases

  1. Go to the folder page and select Managed Service for MySQL.
  2. Click on the name of the cluster you need and select the Databases tab.

If you don't have the Yandex.Cloud command line interface yet, install it.

The folder specified in the CLI profile is used by default. You can specify a different folder using the --folder-name or --folder-id parameter.

To get a list of databases in a cluster, run the command:

$ yc managed-mysql database list
     --cluster-name=<cluster name>

The cluster name can be requested with a list of clusters in the folder.

Creating a database

The number of databases in a cluster is unlimited.

  1. Go to the folder page and select Managed Service for MySQL.
  2. Click on the name of the cluster you need.
  3. If the owner of the new database still doesn't exist, add the user.
  4. Select the Databases tab.
  5. Click Add.
  6. Enter the database name and select its owner.

If you don't have the Yandex.Cloud command line interface yet, install it.

The folder specified in the CLI profile is used by default. You can specify a different folder using the --folder-name or --folder-id parameter.

To create a database in a cluster:

  1. See the description of the CLI's create database command:

    $ yc managed-mysql database create --help
    
  2. Run the create database command:

    $ yc managed-mysql database create <database name> --cluster-name <cluster name>
    

    Managed Service for MySQL runs the create database operation.

The cluster name can be requested with a list of clusters in the folder.

Deleting a database

  1. Go to the folder page and select Managed Service for MySQL.
  2. Click on the name of the cluster you need and select the Databases tab.
  3. Click image in the line of the necessary DB and select Delete.

If you don't have the Yandex.Cloud command line interface yet, install it.

The folder specified in the CLI profile is used by default. You can specify a different folder using the --folder-name or --folder-id parameter.

To delete a database, run the command:

$ yc managed-mysql database delete <database name> --cluster-name <cluster name>

The cluster name can be requested with a list of clusters in the folder.

Important

Before creating a new database with the same name, wait for the delete operation to complete, otherwise the database being deleted is restored. Operation status can be obtained with a list of cluster operations.