InfluxDB: Unauthorized access

I have installed k6.io and InfluxDB on my local system.

I am trying to send k6 analytical data using the below command:
k6 run --out influxdb=http://localhost:8086/myk6db loadtest.js

While I am running this command, I am getting:
Couldn’t write stats error=“{"code":"unauthorized","message":"unauthorized access"}” output=InfluxDBv1

Chances are your InfluxDB instance has some authentication protecting it:

I am using InfluxDB version:2.0.6
Here, where can I get the config file?


I have this many of files in total

k6 doesn’t support InfluxdDB v2 yet, follow Switch to the InfluxDB 2 Go client library · Issue #1730 · grafana/k6 · GitHub for updates. For now, you can downgrade to InfluxDB v1.8 or use the xk6 extension that somebody from the community made for v2 support: GitHub - li-zhixin/xk6-influxdbv2: A k6 extension output to influxdb.