Search code examples
influxdb

How set authenticate in InfluxDB?


I'm having troubling with set authenticate in InfluxDB. First the follow tutorial told me to change the config file:

https://docs.influxdata.com/influxdb/v1.7/administration/authentication_and_authorization/#set-up-authentication

[http]
  enabled = true
  bind-address = ":8086"
  auth-enabled = true # ✨
  log-enabled = true
  write-tracing = false
  pprof-enabled = false
  https-enabled = false
  https-certificate = "/etc/ssl/influxdb.pem"

But when i change, and reload the server. I can't create users.

 CREATE USER paul WITH PASSWORD 'timeseries4days' WITH ALL PRIVILEGES
 ERR: unable to parse Basic Auth credentials
 Warning: It is possible this error is due to not setting a database.
 Please set a database with the command "use <database>".

So, when a use my database that i created:

 USE example
 ERR: unable to parse Basic Auth credentials

Now i don't know what i exactly do to set my authenticate to give only a user (In this case paul) the power to READ and WRITE my database example.


Solution

  • Now that Authentication is enabled, you'll need to authenticate yourself before you can do anything in the database.

    The error unable to parse Basic Auth credentials is suggesting that you did not pass in any credentials.

    If you're trying use the influx binary to create an user then you'll have to set the -username and -password options.

    For instance:

    influx -username "my_username" -password "my_password" \
            -execute "CREATE USER parul WITH PASSWORD 'timeseries4days'