Troubleshooting
Why the InfluxQL shell says database name required
Short answer
The InfluxQL shell opens with no current database, and an unqualified FROM clause is read as a measurement name, so the server rejects the query with database name required. Run USE logs first, take the measurement name from SHOW MEASUREMENTS, and the same query returns rows.

On this page
The error means exactly what it says about the session, not about your data: the InfluxQL shell has no current database. SHOW DATABASES listing logs only proves the bucket mapping exists; it does not select anything. Run USE logs, read the real measurement name from SHOW MEASUREMENTS, and query that measurement. An unqualified FROM clause is parsed as a measurement name, never as the database.
What the error actually tells you #
The banner on screen already tells you which layers are healthy. It reads InfluxQL Shell dev and Connected to InfluxDB OSS v2.7.1: transport, authentication, and the v1 compatibility layer are all working. The database logs appears in the database list, so the bucket-to-database mapping exists too. What is missing is one thing only: no USE was issued, and the query select * from logs gave the server no database qualifier, so the parser has nowhere to look and stops with Error: database name required.
This is a query-syntax and session fault. The Telegraf feed, the Docker containers, and the write path are not implicated by this error, so do not start there.
Why SHOW DATABASES does not select anything #
In InfluxDB 2.x OSS, InfluxQL sees buckets through database and retention-policy mappings, and SHOW DATABASES lists the databases those mappings create. Listing is a read against the mapping table. A SELECT runs against a current database held in the shell session, and that field starts empty every time the shell launches. The list filling the first field does not fill the second.
There is also a naming trap in the query itself. In InfluxQL, FROM takes a measurement. Written bare, from logs asks for a measurement called logs inside the current database. The database name only ever appears in a FROM clause as part of a fully qualified measurement: SELECT * FROM "database-name"."retention-policy-name".home. So even a perfect database name in FROM cannot rescue a session with no USE.
Fix the session in five steps #
- Launch the v1 shell with
influx v1 shelland confirm the Connected banner. - Run SHOW DATABASES and confirm logs is present. If it is not, the fault is the mapping or the write path, not the session.
- Run
USE logs. The shell accepts it silently when it succeeds. - Run SHOW MEASUREMENTS and read the measurement name the Telegraf feed actually created. Do not guess it, and do not reuse the database name.
- Query that measurement, for example
SELECT * FROM home LIMIT 5.
Running the logs session on InfluxDB OSS v2.7.1 #
Inputs, and where each comes from: the banner reports InfluxDB OSS v2.7.1 (the reader's screen); the database is logs (the database list on the same screen); the data is Docker container logs pushed by a Telegraf feed, stored originally in json_file format on the container side (the feed setup); the measurement in this case is home (the measurement the feed created, read from SHOW MEASUREMENTS).
The rule, in words: InfluxQL resolves an unqualified FROM name as a measurement inside the session's current database. No current database and no full qualifier means the server cannot resolve the name, and it returns database name required before touching any data.
The arithmetic, step by step, as the session shows it:
C:> influx v1 shell
InfluxQL Shell dev
Connected to InfluxDB OSS v2.7.1
> SHOW DATABASES
logs
> USE logs
> SHOW MEASUREMENTS
home
> SELECT * FROM home LIMIT 5
Result: rows come back with a time column, tag columns for container attributes, and field columns carrying the log text. The same SELECT that failed without the USE now returns data, which proves the only missing input was the session's current database.
The decision it leads to: when SHOW DATABASES lists the database but a bare FROM fails, the fix is USE plus the measurement name from SHOW MEASUREMENTS. Only when the database is absent from the list, or SHOW MEASUREMENTS comes back empty, does the fault move to the mapping or the write path.
When USE fails or the query still returns nothing #
- USE is refused on an authenticated server. A non-admin account may not run USE; the documented path is to create an admin user, or grant the non-admin ALL privileges on that database through the v1 authorization commands.
- The error returns on the next launch. USE is session-scoped, so reissue it every time, or use the fully qualified form in scripts so they carry no session state.
- A parse error on a name with hyphens or other special characters. Wrap the database and retention-policy names in double quotes, as the fully qualified example shows.
- The database is missing from SHOW DATABASES. In 2.x, InfluxQL only sees buckets with a database and retention-policy mapping; check
influx v1 dbrp listand create the mapping for the bucket if it is absent. - SHOW MEASUREMENTS is empty on a listed database. Telegraf is either writing to a different bucket or has not written yet; check the output bucket in the Telegraf configuration and the Telegraf container log. A container-name resolution problem shows up there, and the fix for that layer is covered in article:telegraf-cannot-reach-an-influxdb-container-by-its-name.
- The rows come back but not the fields you expect. The field and tag key listing commands after USE show how Telegraf split each log entry between tags and fields; the message text sits in a field, container attributes usually in tags.
Confirm the fix #
- USE logs is accepted without an error.
- SHOW MEASUREMENTS returns at least one measurement.
SELECT * FROM home LIMIT 5returns rows with a time column.- Running the query again after a few seconds brings newer timestamps, or a time-filtered query returns fresh rows. That last check proves Telegraf is still writing, not just that the session now resolves.
Session fault or write-path fault #
Split the two layers before changing anything in the feed. A session or syntax error is fixed entirely in the query: USE plus a measurement name, or the fully qualified form. A missing database, an empty measurement list, or stale timestamps is a mapping or write-path fault, fixed in the Telegraf output configuration or the bucket mapping. When a write does land but the values look wrong — one record surviving where several were sent, or floats ending up in a string field — that is the ingest side again, described in article:why-influxdb-keeps-only-the-last-record-of-a-node-red-array-write and article:why-telegraf-stores-only-one-value-of-a-json-array-in-influxdb.
The decision, stated once for both cases: listed database plus database name required is a session fault, fixed with USE and a real measurement name in under a minute; missing or empty database is a feed fault, and no amount of retyping the query will fix it.
Questions asked
Why does the shell say database name required when the database is listed?
SHOW DATABASES proves the database exists and is visible through the v1 compatibility layer. It does not set the session context a query runs in. Until you issue USE logs, or fully qualify the measurement with its database and retention policy, the shell has no current database and the server returns database name required.
Why does SELECT * FROM logs return no results after USE logs?
The FROM clause takes a measurement, not a database. After USE logs, the name logs is looked up as a measurement inside the logs database, and none exists under that name. Run SHOW MEASUREMENTS, read the real measurement name the Telegraf feed created, and query that name instead.
Why does the error come back every time I open a new shell?
USE is session-scoped: it sets the current database for that shell session only. Every new launch of the v1 shell starts with no current database. Reissue USE after each launch, or make a script independent of session state by querying the fully qualified form with database and retention policy named explicitly.
Why does the stored log data not look like JSON?
json_file describes the container log format on the Docker side only. Telegraf converts each entry into a point: a measurement, tags, fields, and a timestamp. The message text lands in a field and attributes such as the container name land in tags, so a tabular result with a time column is the correct shape, not a JSON document.


