Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to create database and user in influxdb programmatically?

In my use case I am using single ec2 instance [not a cluster]. I want to create a database and an user with all privileges programmatically? Is there a config file which I can edit and copy to the right location after influxdb is installed.

Could someone help me with this?

like image 836
Dany Avatar asked Aug 01 '26 22:08

Dany


1 Answers

There isn't any config option that you can use to do that with InfluxDB itself. After starting up an instance you can use the InfluxDB HTTP to create the users. The curl command to do so would be the following:

curl "http://localhost:8086/query" --data-urlencode "q=CREATE USER myuser WITH PASSWORD 'mypass' WITH ALL PRIVILEGES"

Just run this command for each of the users you'd like to create. After that, you'll need to enabled the auth value of the [http] section of the config.

like image 174
Michael Desa Avatar answered Aug 03 '26 14:08

Michael Desa



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!