Where Does MotherDuck Store Tokens and Local Data?
MotherDuck CLI credentials file, token env vars and where local DuckDB files live.
Last updated
MotherDuck splits auth from data on purpose. Your databases live in the cloud under md:my_db style names. Locally there are only two things: the token that proves who you are, and any plain DuckDB files you chose to keep on disk.
The install script puts the MotherDuck CLI under ~/.motherduck/ and motherduck login persists the token to credentials.json there. The DuckDB CLI and drivers ignore that file and read the motherduck_token environment variable (or a token inside the connection string) instead. Local .db files sit wherever your path says, often the project root.
Where MotherDuck stores this, by platform
%USERPROFILE%\.motherduck\credentials.json
CLI token store from motherduck new and motherduck login. DuckDB clients still need motherduck_token in the environment or ?motherduck_token= in the md: URL. Local files use duckdb:///C:/path/to/file.db style URIs.
~/.motherduck/credentials.json
Same CLI store as Linux. Export motherduck_token before launching duckdb "md:", or embed it per connection. Local development files are ordinary .db files wherever you created them.
~/.motherduck/credentials.json
Written by the install script flow. The motherduck extension does not read it, so a later ATTACH 'md:' without the env var drops into browser login. Keep MOTHERDUCK_TOKEN in .env for app code, never in git.
Frequently asked questions
why does duckdb still ask me to log in after motherduck login
The two CLIs use separate stores. motherduck login writes ~/.motherduck/credentials.json for the motherduck CLI only. Export motherduck_token with the same value before running duckdb, or pass it in the md:my_db?motherduck_token= URL.
where is my local DuckDB file for MotherDuck work
Wherever you put it. A URI like duckdb:///path/to/file.db names the file directly, and :memory: keeps nothing. The cloud side (md:my_db) holds no local copy until you export or ATTACH and copy tables across.
Notice an outdated path? Let us know.