3314
MySQLERRORNotableSpatial / GISHIGH confidence

Spatial Reference System already exists

Production Risk

Low — DDL fails; no data is modified.

How to reproduce
trigger — this will error
trigger — this will error
CREATE SPATIAL REFERENCE SYSTEM 4326 NAME 'WGS 84' DEFINITION '...';

expected output

ERROR 3314 (HY000): There is already a spatial reference system with SRID 4326.

Fix

Use OR REPLACE

Use OR REPLACE
CREATE OR REPLACE SPATIAL REFERENCE SYSTEM 4326 NAME 'WGS 84' DEFINITION '...';

Why this works

OR REPLACE allows updating an existing SRS definition.

What not to do

Sources
Official documentation ↗

MySQL 8.0 — 3314 ER_SRS_ALREADY_EXISTS

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

← All MySQL errors