Automatically create Database if not present

Hello,

I am using influxdb 1.7.9. Is there any way that influxdb automatically creates a database if not present when the first attempt to write a point is made?
if not, what is the best way to check if DB is created or not?

Regards,
pei

On the InfluxDB side, you can automatically create the default retention policy on database creation, but not the db itself.

[meta]
  {...}
  retention-autocreate = true
  {...}

If you are using Telegraf, it can send a database creation command if enabled in the conf (but not RP creation)

[[outputs.influxdb]]
  {...}
  skip_database_creation = false
  {...}

Note that the InfluxDB user used by telegraf needs to be an admin in order to create databases.

If you want to do something manually you can check if a db exists by using “SHOW DATABASES”, and then do something based on the result

Thank you Yes, currently, I am doing the same way by “SHOW DATABASES”.