3060
MariaDBERRORNotableSchemaHIGH confidence
No database selected
Production Risk
Low — query fails with an error; no data is modified.
What this means
A query was executed without a default schema selected and no schema qualifier was provided. MySQL cannot determine which database to use.
Why it happens
- 1No USE <db> statement was issued before executing a query.
- 2The query references an unqualified table name with no default database set.
How to reproduce
trigger — this will error
trigger — this will error
SELECT * FROM mytable; -- no USE db issued
expected output
ERROR 3060 (HY000): No database selected
Fix 1
Select a database first
Select a database first
USE mydb; SELECT * FROM mytable;
Why this works
Setting the default schema allows MySQL to resolve unqualified table names.
Fix 2
Qualify table names explicitly
Qualify table names explicitly
SELECT * FROM mydb.mytable;
Why this works
Fully qualified names do not require a default schema.
What not to do
✕
Sources
Official documentation ↗
MySQL 8.0 — 3060 ER_QUERY_WITHOUT_SCHEMA2
Content generated with AI assistance and reviewed for accuracy. Found an error? hello@errcodes.dev