npx wrangler d1 create my-db

Category: Cloudflare

npx wrangler d1 create my-db

Create a new D1 database

D1 is Cloudflare's serverless SQLite database, and this provisions an empty one named my-db. The output includes a database_id you must add to wrangler.toml as a binding before your Worker can query it. Then create tables with `wrangler d1 execute my-db --file ./schema.sql`.
Looking for more? Search all 7,657 commands — works offline, in English or Spanish, and fixes typos.