MySQL error 1054 (Unknown Column) explained: what it means, why it happens, and how to fix it — with copy-paste code examples.
Read the message: it names the unknown column and the context ('Unknown column \'x\' in \'field list\''). If that does not apply, verify the real columns: `SHOW COLUMNS FROM tablename;` or `DESCRIBE tablename;` — the full checklist is below.
MySQL Error Code: 1054
Official name: Unknown Column
System name: Unknown column
Service: MySQL
Unknown column '%s' in '%s'
A deploy ships code that selects users.full_name, but the migration renaming the column to full_name never ran on production. MySQL returns ERROR 1054 (42S22): Unknown column 'full_name' in 'field list'. The quoted qualifier tells you where it was referenced — field list (SELECT), where clause (WHERE), or order clause — which narrows down which statement in the app needs attention.
Run these to confirm the cause before applying a fix — each command answers a specific question.
SHOW COLUMNS FROM users;
Spot the rename or typo immediately — comparing this list against the failing statement resolves most 1054s.
SELECT table_schema, column_name
FROM information_schema.columns
WHERE table_name = 'users' AND column_name LIKE '%name%';
Finds the column under its old or similar name; also catches schema/database mix-ups.
Column missing on this table?
├─ migration not applied → apply it, or
├─ column renamed → update the query (or alias: old_name AS new_name)
└─ typo in SQL → fix the identifier spelling
Column exists but still 'unknown'?
├─ ambiguity in a JOIN → qualify: u.full_name (not bare full_name)
├─ referencing the wrong table in the join
└─ view/derived table lacks the column → rebuild the view
SHOW COLUMNS FROM users;
-- compare with the column name in the failing query
Lists the actual columns so you can spot typos or stale names immediately.
Log err.sql to see the exact column the query uses vs what the schema has.
catch (err) {
if (err.code === 'ER_BAD_FIELD_ERROR') console.error(err.sql)
}
Compare the model to the actual table; a stale model is the usual cause.
print(Column('email', String)) # model must match the table
# run: alembic upgrade head to sync
Qualify join columns explicitly so the query cannot be ambiguous.
$sql = 'SELECT o.id, u.name FROM orders o JOIN users u ON o.user_id = u.id';
// always table.column in JOINs
Most often this happens when referencing a column that does not exist (typo, renamed column, wrong table), or when ambiguous column in a JOIN without table qualification: `SELECT id ... FROM a JOIN b`.
Read the message: it names the unknown column and the context ('Unknown column \'x\' in \'field list\'').
This page documents fixes for: nodejs-mysql2, python-sqlalchemy, php-pdo.
Recommendations are editorial — DB Error Reference takes no payment or affiliate fees for tool listings.
This page is based on the official MySQL documentation linked below and adds practical troubleshooting guidance on top.