Free toolsLocal D1 helper
Local D1 helper for Cloudflare Workers
Build the exact wrangler d1 command to query, migrate or export your local D1 database. Then find where the data lives and fix the usual "no such table" error. Free, and it runs in your browser.
Your command
npx wrangler d1 execute DB --local --command "SELECT 1"
This targets your remote database. Changes to a remote D1 database cannot be undone.
Where is the local D1 database?
By default, Wrangler and the Vite plugin store local data in the .wrangler/state folder of your project. D1 databases are SQLite files with generated names inside it. To list them:
$ find .wrangler/state -name "*.sqlite"You can open any of those files with the sqlite3 command line tool or a SQLite app. If you start the dev server with --persist-to <folder>, the data lives in that folder instead.
Fix "no such table" on a local database
- Missing
--local. Without it,wrangler d1 executeruns against the remote database. - Migrations were applied elsewhere. Run
wrangler d1 migrations apply YOUR_DB --localso the local copy has your tables. - Different state folders. If you started
wrangler devwith--persist-to, pass the same flag, plus--local, to your other Wrangler commands. Otherwise they read a different database.
Reset your local D1 data
Delete the .wrangler/state folder at any time. Miniflare recreates it the next time you run your dev command, and you can delete a single subfolder for a more targeted reset. Apply your migrations again afterwards.
$ rm -rf .wrangler/state $ npx wrangler d1 migrations apply YOUR_DB --local
Frequently asked questions
Does wrangler dev use my production database?
No. It runs in local mode by default, with Miniflare and workerd, and does not touch production data unless you set remote: true on the D1 binding.
Does this page send my SQL anywhere?
No. The command is built in your browser. Nothing is uploaded or stored.
Browse local D1 without the command line.
WorkerDock shows every local Worker, the D1, KV and R2 it is wired to, and opens Cloudflare's Local Explorer in one window.