3335
MySQLERRORNotableSpatial / GISHIGH confidence

Spatial column requires an explicit SRID

Production Risk

Low — DDL fails; no table or index is created.

How to reproduce
trigger — this will error
trigger — this will error
CREATE TABLE t (geom POINT NOT NULL, SPATIAL INDEX(geom)); -- no SRID

expected output

ERROR 3335 (HY000): A spatial reference system is required for spatial column 'geom'.

Fix

Specify an SRID

Specify an SRID
CREATE TABLE t (geom POINT SRID 4326 NOT NULL, SPATIAL INDEX(geom));

Why this works

An explicit SRID lets MySQL validate geometries and use the correct axis order.

What not to do

Sources
Official documentation ↗

MySQL 8.0 — 3335 ER_SRID_MANDATORY

Content generated with AI assistance and reviewed for accuracy. Found an error? hello@errcodes.dev

← All MySQL errors