Info
Content

Useful Database Commands [CLI]

This page lists useful commands for using InfluxDB via the HTTP query API. This commands can be run from a CLI terminal that has access to cURL.

Create a new Database

curl -XPOST "http://<location.of.influx.db>/query" --data-urlencode "q=CREATE DATABASE "<db_name>""

Create a new Database when InfluxDB is using authentication

curl -XPOST "http://<location.of.influx.db>/query?u=<admin user>&p=<password>" --data-urlencode "q=CREATE DATABASE "<db_name>""

Create a Database user with WRITE permission

curl -i -XPOST "http://<location.of.influx.db/query" --data-urlencode "q=GRANT WRITE ON "<db_name>" WITH PASSWORD "<username>""

Create a Database user with WRITE permission when InfluxDB is using authentication

curl -i -XPOST "http://<location.of.influx.db>/query?u=<admin user>&p=<password>" --data-urlencode "q=GRANT WRITE ON "<db_name>" WITH PASSWORD "<username>""

Create a Database user with READ permission

curl -i -XPOST "http://<location.of.influx.db/query" --data-urlencode "q=GRANT READ ON "<db_name>" WITH PASSWORD "<username>""

Create a Database user with READ permission when InfluxDB is using authentication

curl -i -XPOST "http://<location.of.influx.db>/query?u=<admin user>&p=<password>" --data-urlencode "q=GRANT WRITE ON "<db_name>" WITH PASSWORD "<username>""

 

Back to top