Exporting Data for Import into Cloud SQL

This page describes how to create a SQL dump file that is usable by Cloud SQL. You can use this file to import your data into Cloud SQL.

For general best practices for importing data into Cloud SQL, see Best Practices for Importing and Exporting Data.

Creating a SQL dump file

You use pg_dump to create your SQL dump file with the following flags:

  • --no-owner Ownership change commands must not be included in the SQL dump file.
  • --format=plain Only plain SQL format is currently supported by Cloud SQL.

From a command line, run pg_dump:

pg_dump -U [USERNAME] --format=plain --no-owner [DATABASE_NAME] > [SQL_FILE].sql

For more information about pg_dump, see the pg_dump reference.

What's next

Send feedback about...

Cloud SQL for PostgreSQL