Skip to main content

Step 3: Create a logical database

When creating a logical database, Turso requires a location for the [primary instance]. By default, it will select a default location based on your physical location as suggested by your IP address. To see all locations supported by Turso, run the following command:

turso db locations

Your default location appears highlighted in the list.

To create a database using the default location with the name my-db:

turso db create my-db

It takes a few moments to create the database, then generates output similar to the following (with replacements for the parts that may vary):

Created database my-db in [Your Location] in [xx] seconds.

You can start an interactive SQL shell with:

turso db shell my-db

To see information about the database, including a connection URL, run:

turso db show my-db
note

You can override the default location using the --location flag.

note

If you don’t provide a database name on the command line, a random name is generated for you.

As suggested by the output, you can view information about the database using:

turso db show my-db

The output looks similar to the following:

Name:           my-db
URL: libsql://my-db-[my-github-name].turso.io
ID: [UUID]
Locations: [location]
Size: 0 B

Database Instances:
NAME TYPE LOCATION VERSION
[random-name] primary [location] 0.14.0

Note the following in the above output:

  • Database URLs use a custom libsql scheme, and are composed using a combination of the name of the database and your GitHub ID.
  • The first URL is the logical database URL that you provide to libSQL client libraries to query the database. This URL automatically forwards the client to the closest instance.
  • The primary instance has a random name that was assigned by the CLI.

To see a list of all logical databases associated with the account that's currently logged in:

turso db list