npx wrangler d1 export my-db --remote --output backup.sql

Category: Cloudflare

npx wrangler d1 export my-db --remote --output backup.sql

Export a D1 database to a SQL file

Dumps the schema and data of the remote database into backup.sql, the standard way to take a portable snapshot or migrate off Cloudflare. --local exports the local copy instead, and --no-schema or --no-data narrows the dump. Restore it later by running the file with `wrangler d1 execute`.
Looking for more? Search all 7,657 commands — works offline, in English or Spanish, and fixes typos.