Documentation

influxdb3 create database

The influxdb3 create database command creates a new database in your InfluxDB 3 Core instance.

Provide a database name and, optionally, specify connection settings and authentication credentials using flags or environment variables.

Usage

influxdb3 create database [OPTIONS] <DATABASE_NAME>

Arguments

  • DATABASE_NAME: The name of the database to create. Valid database names are alphanumeric and start with a letter or number. Dashes (-) and underscores (_) are allowed.

You can also set the database name using the INFLUXDB3_DATABASE_NAME environment variable.

Options

OptionDescription
-H--hostHost URL of the running InfluxDB 3 Core server (default is http://127.0.0.1:8181)
--retention-periodDatabase retention period (duration value, for example: 30d, 24h, 1h)
--tokenAuthentication token
--tls-caPath to a custom TLS certificate authority (for testing or self-signed certificates)
-h--helpPrint help information
--help-allPrint detailed help information

Option environment variables

You can use the following environment variables instead of providing CLI options directly:

Environment VariableOption
INFLUXDB3_HOST_URL--host
INFLUXDB3_AUTH_TOKEN--token

Examples

The following examples show how to create a database.

In your commands replace the following:

  • DATABASE_NAME: Database name
  • AUTH_TOKEN: Authentication token

Create a database (default)

Creates a database using settings from environment variables and defaults.

influxdb3 create database 
DATABASE_NAME

Create a database with an authentication token

Creates a database using the specified arguments. Flags override their associated environment variables.

influxdb3 create database --token 
AUTH_TOKEN
DATABASE_NAME

Create a database with a retention period

Creates a database with a specific retention period.

influxdb3 create database --retention-period 30d 
DATABASE_NAME

Was this page helpful?

Thank you for your feedback!


The future of Flux

Flux is going into maintenance mode. You can continue using it as you currently are without any changes to your code.

Read more

New in InfluxDB 3.2

Key enhancements in InfluxDB 3.2 and the InfluxDB 3 Explorer UI is now generally available.

See the Blog Post

InfluxDB 3.2 is now available for both Core and Enterprise, bringing the general availability of InfluxDB 3 Explorer, a new UI that simplifies how you query, explore, and visualize data. On top of that, InfluxDB 3.2 includes a wide range of performance improvements, feature updates, and bug fixes including automated data retention and more.

For more information, check out: