Create and manage a database

This page describes how to create and manage a database in AlloyDB for PostgreSQL.

Before you begin

The Google Cloud project you use must be enabled to access AlloyDB .

You must have one of the following IAM roles in the Google Cloud project that you're using:

  • roles/alloydb.admin : the AlloyDB Admin predefined IAM role
  • roles/owner : the Owner basic IAM role
  • roles/editor : the Editor basic IAM role

If you don't have any of these roles, contact your Organization Administrator to request access.

Create a database

Before you can create a database, you must create a cluster and its primary instance .

To create a database, complete the following steps:

  1. In the Google Cloud console, go to the Clusterspage.

    Go to Clusters

  2. In the Resources namecolumn, click the name of your cluster.

  3. In the navigation pane, click Databases.

  4. Click Create a database. A dialog window opens that suggests a query to use in AlloyDB Studio.

  5. Copy the query and click Open in Studio. The AlloyDB Studio page opens with an additional Log in to your databasedialog window.

  6. In the Log in to your databasewindow, make the following selections:

  7. Click Authenticate. The Explorerpane displays a list of the objects in the postgres database.

  8. Select the Untitled Querytab and paste the following query that you copied:

      CREATE 
      
     DATABASE 
      
      DATABASE_NAME 
     
     ; 
     
    

    Replace DATABASE_NAME with the name of the database.

  9. Click Run.

    If the Statement executed successfullymessage displays in the Resultspane, then you know that you created your database.

List a database

To list all databases on a cluster, complete the following steps:

  1. In the Google Cloud console, go to the Clusterspage.

    Go to Clusters

  2. To open the Overviewpage of a cluster, click the cluster name in the Resources namecolumn.

  3. Click Databasesfrom the left-side menu. The Databasespage lists the database names along with their collation type and character set.

Delete a database

To delete a database in a cluster, complete the following steps:

  1. In the Google Cloud console, go to the Clusterspage.

    Go to Clusters

  2. To open the Overviewpage of a cluster, click the cluster name in the Resources namecolumn.

  3. Click Databasesfrom the left-side menu. The Databasespage lists the database names along with their collation type and character set.

  4. Choose a database to delete, click the three-dot menu in that row, and select Drop. A Drop a databasedialog window opens.

  5. Click Open in Studio.

  6. In the open Untitled Querytab, Click Run.

    If the Statement executed successfullymessage displays in the Resultspane, then you know that you deleted the database.

Design a Mobile Site
View Site in Mobile | Classic
Share by: