How to create a new database with influx db

This is a short post detailing the command you can use to create a new Influx DB database

Creating a new InfluxDB database

To quickly create a new InfluxDB database you can use curl.

If your database API is configured on localhost:8086 you can run the following command:

curl -i -XPOST http://localhost:8086/query --data-urlencode "q=CREATE DATABASE room_measurements"

This talks to the InfluxDB and asks it to create a database room_measurements.

Once called you should get a response similar to this below.

HTTP/1.1 200 OK
Content-Type: application/json
Request-Id: ac3957b6-714b-11ea-8004-94de8072629c
X-Influxdb-Build: OSS
X-Influxdb-Version: 1.7.10
X-Request-Id: ac3957b6-714b-11ea-8004-94de8072629c
Date: Sat, 28 Mar 2020 23:27:21 GMT
Transfer-Encoding: chunked


A response code of 200 suggests that the database has been created successfully.

Now this has been created you are free to start adding data to InfluxDB


Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.