May 2, 2020
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
{"results":[{"statement_id":0}]}
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
4 Comments
{“results”:[{“statement_id”:0,”error”:”not implemented: CREATE DATABASE”}]}
I get this when i try to create a DB. What am i missing?
I don’t get that, what version are you running?
{
“results”: [
{
“statement_id”: 0,
“error”: “not implemented: CREATE DATABASE”
}
]
}
I get the above error is the response message. My version of InfluxDB is “InfluxDB 2.1.1”
This is for Influx DB V1 and not V2, you probably need a different command 🙁