Skip to main content

Installing and Using the DuckDB CLI

Installation

caution

MotherDuck currently supports DuckDB 1.1.3 and it is compatible with any client version 0.10.2 through 1.1.3

Download and install the DuckDB binary, depending on your operating system.

  1. Download the 64-bit Windows binary here
  2. Extract the Zip File.

For more information, see the DuckDB installation documentation.

Run the DuckDB CLI

Run DuckDB using the command:

./duckdb

By default, DuckDB will start with an in-memory database and any changes will not be persisted. To create a persistent database in the DuckDB CLI, you can specify a new filename as the first argument to the duckdb command.

Example:

./duckdb mydatabase.ddb

Connect to MotherDuck

You can connect to MotherDuck by executing the following in DuckDB CLI. DuckDB will automatically download and load the signed MotherDuck extension.

ATTACH 'md:';

DuckDB will prompt you to authenticate with MotherDuck using your default web browser. Follow the instructions displayed in the terminal.

Test your MotherDuck connection using the following command. It will run in the cloud to display a list of your MotherDuck databases.

show databases;

Congrats 🎉 You are connected!

Now you can create databases and switch between them. You can also connect to your local DuckDB databases alongside databases hosted in MotherDuck, and interact with both!

To know more about how to persist your authentication credentials, read Authenticating to MotherDuck

info

Note you can also connect to MotherDuck directly when starting DuckDB CLI by running the following command:

duckdb "md:"

Upgrading MotherDuck via the DuckDB CLI:

If you have previously installed the extension, but we have upgraded the service, you may need to run the FORCE INSTALL command as shown in the following example.

FORCE INSTALL motherduck