CREATE DATABASE "example_db" WITH OWNER "example_user" ENCODING 'UTF8' LC_COLLATE = 'pl_PL.utf8' LC_CTYPE = 'pl_PL.utf8' TEMPLATE template0;
Note: The default template is template1
. However, psql uses template0
because it's the only template that accepts a specific encoding and character set. For more information, see Template Databases . List your databases To list all databases on an instance:
Console In the Google Cloud console, go to the Cloud SQL Instances page.
Go to Cloud SQL Instances
To open the Overview page of an instance, click the instance name. Click Databases from the left side menu. The Databases page lists databases along with their collation type, character set, and database type. REST v1 The following request uses the databases:list method to list the databases for an instance.
When you list the databases using the API, you see additional template databases and a system database that are not displayed by the console. You cannot delete or manage the system database.
Before using any of the request data, make the following replacements:
project-id : The project IDinstance-id : The instance ID HTTP method and URL:
GET https://sqladmin.googleapis.com/v1/projects/project-id /instances/instance-id /databases To send your request, expand one of these options:
curl (Linux, macOS, or Cloud Shell) Note: The following command assumes that you have logged in to the gcloud
CLI with your user account by running gcloud init
or gcloud auth login
, or by using Cloud Shell , which automatically logs you into the gcloud
CLI . You can check the currently active account by running gcloud auth list
. Execute the following command:
curl -X GET \ -H "Authorization: Bearer $(gcloud auth print-access-token)" \ "https://sqladmin.googleapis.com/v1/projects/project-id /instances/instance-id /databases" PowerShell (Windows) Execute the following command:
$cred = gcloud auth print-access-token $headers = @{ "Authorization" = "Bearer $cred" } Invoke-WebRequest ` -Method GET ` -Headers $headers ` -Uri "https://sqladmin.googleapis.com/v1/projects/project-id /instances/instance-id /databases" | Select-Object -Expand Content You should receive a JSON response similar to the following:
Response
{ "kind": "sql#database", "charset": "utf8", "collation": "utf8_general_ci", "etag": "etag ", "name": "sys", "instance": "instance-id ", "selfLink": "https://sqladmin.googleapis.com/v1/projects/project-id /instances/instance-id /databases/sys", "project": "project-id " } REST v1beta4 The following request uses the databases:list method to list the databases for an instance.
When you list the databases using the API, you see additional template databases and a system database that are not displayed by the console. You cannot delete or manage the system database.
Before using any of the request data, make the following replacements:
project-id : The project IDinstance-id : The instance ID HTTP method and URL:
GET https://sqladmin.googleapis.com/sql/v1beta4/projects/project-id /instances/instance-id /databases To send your request, expand one of these options:
curl (Linux, macOS, or Cloud Shell) Note: The following command assumes that you have logged in to the gcloud
CLI with your user account by running gcloud init
or gcloud auth login
, or by using Cloud Shell , which automatically logs you into the gcloud
CLI . You can check the currently active account by running gcloud auth list
. Execute the following command:
curl -X GET \ -H "Authorization: Bearer $(gcloud auth print-access-token)" \ "https://sqladmin.googleapis.com/sql/v1beta4/projects/project-id /instances/instance-id /databases" PowerShell (Windows) Execute the following command:
$cred = gcloud auth print-access-token $headers = @{ "Authorization" = "Bearer $cred" } Invoke-WebRequest ` -Method GET ` -Headers $headers ` -Uri "https://sqladmin.googleapis.com/sql/v1beta4/projects/project-id /instances/instance-id /databases" | Select-Object -Expand Content You should receive a JSON response similar to the following:
Response
{ "kind": "sql#database", "charset": "utf8", "collation": "utf8_general_ci", "etag": "etag ", "name": "sys", "instance": "instance-id ", "selfLink": "https://sqladmin.googleapis.com/sql/v1beta4/projects/project-id /instances/instance-id /databases/sys", "project": "project-id " } psql Client For reference information, see list .
When you list the databases using the psql
client, you see additional template databases and a system database that are not displayed by the console. You cannot delete or manage the system database.
\ l Delete a database To delete a database on the Cloud SQL instance:
Console In the Google Cloud console, go to the Cloud SQL Instances page.
Go to Cloud SQL Instances
To open the Overview page of an instance, click the instance name. Click Databases from the left side menu. In the database list, find the database you want to delete and click the trash can icon. In the Delete database dialog, enter the name of the database and then click Delete . REST v1 The following request uses the databases:delete method to delete the specified database.
Before using any of the request data, make the following replacements:
project-id : The project IDinstance-id : The instance IDdatabase-name : The name of a database inside the Cloud SQL instance HTTP method and URL:
DELETE https://sqladmin.googleapis.com/v1/projects/project-id /instances/instance-id /databases/database-name To send your request, expand one of these options:
curl (Linux, macOS, or Cloud Shell) Note: The following command assumes that you have logged in to the gcloud
CLI with your user account by running gcloud init
or gcloud auth login
, or by using Cloud Shell , which automatically logs you into the gcloud
CLI . You can check the currently active account by running gcloud auth list
. Execute the following command:
curl -X DELETE \ -H "Authorization: Bearer $(gcloud auth print-access-token)" \ "https://sqladmin.googleapis.com/v1/projects/project-id /instances/instance-id /databases/database-name " PowerShell (Windows) Execute the following command:
$cred = gcloud auth print-access-token $headers = @{ "Authorization" = "Bearer $cred" } Invoke-WebRequest ` -Method DELETE ` -Headers $headers ` -Uri "https://sqladmin.googleapis.com/v1/projects/project-id /instances/instance-id /databases/database-name " | Select-Object -Expand Content You should receive a JSON response similar to the following:
Response
{ "kind": "sql#operation", "targetLink": "https://sqladmin.googleapis.com/v1/projects/project-id /instances/instance-id ", "status": "PENDING", "user": "user@example.com", "insertTime": "2020-01-21T22:43:37.981Z", "operationType": "DELETE_DATABASE", "name": "operation-id ", "targetId": "instance-id ", "selfLink": "https://sqladmin.googleapis.com/v1/projects/project-id /operations/operation-id ", "targetProject": "project-id " } REST v1beta4 The following request uses the databases:delete method to delete the specified database.
Before using any of the request data, make the following replacements:
project-id : The project IDinstance-id : The instance IDdatabase-name : The name of a database inside the Cloud SQL instance HTTP method and URL:
DELETE https://sqladmin.googleapis.com/sql/v1beta4/projects/project-id /instances/instance-id /databases/database-name To send your request, expand one of these options:
curl (Linux, macOS, or Cloud Shell) Note: The following command assumes that you have logged in to the gcloud
CLI with your user account by running gcloud init
or gcloud auth login
, or by using Cloud Shell , which automatically logs you into the gcloud
CLI . You can check the currently active account by running gcloud auth list
. Execute the following command:
curl -X DELETE \ -H "Authorization: Bearer $(gcloud auth print-access-token)" \ "https://sqladmin.googleapis.com/sql/v1beta4/projects/project-id /instances/instance-id /databases/database-name " PowerShell (Windows) Execute the following command:
$cred = gcloud auth print-access-token $headers = @{ "Authorization" = "Bearer $cred" } Invoke-WebRequest ` -Method DELETE ` -Headers $headers ` -Uri "https://sqladmin.googleapis.com/sql/v1beta4/projects/project-id /instances/instance-id /databases/database-name " | Select-Object -Expand Content You should receive a JSON response similar to the following:
Response
{ "kind": "sql#operation", "targetLink": "https://sqladmin.googleapis.com/sql/v1beta4/projects/project-id /instances/instance-id ", "status": "PENDING", "user": "user@example.com", "insertTime": "2020-01-21T22:43:37.981Z", "operationType": "DELETE_DATABASE", "name": "operation-id ", "targetId": "instance-id ", "selfLink": "https://sqladmin.googleapis.com/sql/v1beta4/projects/project-id /operations/operation-id ", "targetProject": "project-id " } psql Client For reference information, see DROP DATABASE in the PostgreSQL documentation.
DROP DATABASE [ database_name ]; What's next Try it for yourself If you're new to Google Cloud, create an account to evaluate how Cloud SQL performs in real-world scenarios. New customers also get $300 in free credits to run, test, and deploy workloads.
Try Cloud SQL free Send feedback
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License , and code samples are licensed under the Apache 2.0 License . For details, see the Google Developers Site Policies . Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2025-04-17 UTC.
Need to tell us more? [[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-04-17 UTC."],[],[]]