2.3 KiB
| title | description | menu | weight | list_code_example | related | ||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
| Rename a database | Use the [`influxctl database rename` command](/influxdb3/clustered/reference/cli/influxctl/database/rename/) to rename a database in your {{< product-name omit=" Cluster" >}} cluster. |
|
202 | ##### CLI ```sh influxctl database rename <DATABASE_NAME> <NEW_DATABASE_NAME> ``` |
|
Use the influxctl database rename command
to rename a database in your {{< product-name omit=" Cluster" >}} cluster.
[!Note] Renaming a database does not change the database ID, modify data in the database, or update database tokens. After renaming a database, any existing database tokens will stop working and you must create new tokens with permissions for the renamed database.
If you create a new database using the previous database name, tokens associated with that database name will grant access to the newly created database.
Rename a database using the influxctl CLI
{{% code-placeholders "DATABASE_NAME|NEW_DATABASE_NAME" %}}
influxctl database rename DATABASE_NAME NEW_DATABASE_NAME
{{% /code-placeholders %}}
Replace the following:
- {{% code-placeholder-key %}}
DATABASE_NAME{{% /code-placeholder-key %}}: Current name of the database to rename - {{% code-placeholder-key %}}
NEW_DATABASE_NAME{{% /code-placeholder-key %}}: New name for the database
Update database tokens after renaming
After renaming a database, existing database tokens will no longer work because they reference the old database name. Do the following:
- Create new database tokens with permissions for the renamed database.
- Update your applications and clients to use the new tokens.
- Delete the old database tokens that reference the old database name.
{{% note %}}
Renamed database retains its ID
The database ID remains the same after renaming. When you list databases, you'll see the new name associated with the original database ID. {{% /note %}}