How to Fix MySQL Error 3682 (ER_ONLY_IMPLEMENTED_FOR_SRID_0_AND_4326)
You get mysql error 3682 when you run a spatial function on unsupported spatial reference IDs. You fix it by converting your geometry data to SRID 0 or SRID 4326 first. MySQL logs this problem with symbol ER_ONLY_IMPLEMENTED_FOR_SRID_0_AND_4326 and SQLSTATE 22S00. The engine stops your query because the spatial function only supports flat planes or standard GPS coordinates. What causes mysql error 3682 in your database Spatial data uses a Spatial Reference System Identifier, or SRID, to defi
Your coding agents run with your access.
Claude Code reaches prod with a developer's credentials, and approval prompts get clicked through. hoop.dev checks every query, masks sensitive data, and holds risky changes for a human.
You get mysql error 3682 when you run a spatial function on unsupported spatial reference IDs. You fix it by converting your geometry data to SRID 0 or SRID 4326 first.
MySQL logs this problem with symbol ER_ONLY_IMPLEMENTED_FOR_SRID_0_AND_4326 and SQLSTATE 22S00. The engine stops your query because the spatial function only supports flat planes or standard GPS coordinates.
What causes mysql error 3682 in your database
Spatial data uses a Spatial Reference System Identifier, or SRID, to define shapes on Earth. Different maps and apps use different SRID numbers for local grids or regional projections.
MySQL supports many SRID values for storing points, lines, and polygons in tables. Still, certain built-in spatial functions only know how to calculate math for two specific systems.
The first supported system is SRID 0, which represents an infinite flat Cartesian plane. The second is SRID 4326, which represents the standard WGS 84 latitude and longitude globe.
When an app sends geometry data with another SRID to these functions, the query fails. The database engine returns error code 3682 and states the function only works for 0 and 4326.
This issue often appears when teams import regional GIS data from external mapping tools. Local government maps and web mercator projections use their own SRID numbers by default.
How to diagnose and fix the SRID mismatch
Start your check by finding which spatial function triggered the failure in your query log. The error message names the exact function that rejected your geometry input.
Next, inspect the SRID of the geometry column or input value in that query. You can run a read-only check on the table metadata or check the SRID of sample rows.
MySQL Access Governance + End-to-End Encryption: architecture patterns and best practices
Continue reading? Get the full guide.
Free. No spam. Unsubscribe anytime.
If your data uses a projected coordinate system like Web Mercator, you have two safe options. Your first option is transforming the geometry to SRID 4326 inside your read query.
MySQL provides a built-in spatial transform function that converts shapes between different geographic reference systems. This approach lets you keep your stored table data untouched while fixing the query output.
Your second option is updating the column data to use SRID 4326 or SRID 0 permanently. Only choose SRID 0 if your app uses flat grid math instead of real globe distances.
Before changing any stored data in production, test the spatial conversion in a staging database. Check that your spatial indexes still work and that distance results match your app rules.
How to prevent spatial errors in production
You can stop this error early by setting clear SRID rules on your geometry columns. When you define a spatial column with SRID 4326, MySQL blocks inserts with other SRID values.
This schema rule catches bad coordinate systems during data import instead of breaking user queries later. It also lets the database optimizer use spatial indexes on that column during searches.
Make sure your backend code and data pipelines convert external map files before writing to MySQL. Standardizing on SRID 4326 across your whole stack keeps spatial math fast and predictable.
When engineers inspect production data to debug spatial errors, use least-privilege database roles. Grant read-only permissions for diagnostic checks, and mask sensitive columns like emails or phone numbers in results.
Add wire guardrails and masking beside MySQL
Database grants and TLS setup decide who can reach MySQL. Even so, an open session can run broad updates or read raw personal data from allowed tables. In practice, hoop.dev sits inline in the wire protocol beside the database as a sidecar for your MySQL. On every production query an agent or engineer sends, hoop.dev decides to pass, mask, block, or escalate it for human review.
With hoop.dev MySQL support, guardrails refuse bad queries before they run or hold risky calls for approval, while data masking rewrites matched sensitive values in result rows in memory. Furthermore, hoop.dev holds SOC 2 Type II and generates evidence for GDPR, HIPAA, and PCI DSS programs. Read the docs and source on GitHub.
Frequently asked questions
What does ER_ONLY_IMPLEMENTED_FOR_SRID_0_AND_4326 mean in MySQL?
This symbol means you passed a geometry with an unsupported SRID into a spatial function. The function you called only knows how to calculate results for SRID 0 or SRID 4326.
Should I use SRID 0 or SRID 4326 to fix mysql error 3682?
Use SRID 4326 if your data represents real GPS latitude and longitude points on Earth. Use SRID 0 only if you work with a flat, unitless grid plane.
Can I fix error 3682 without altering my existing database tables?
Yes, you can convert the geometry value to SRID 4326 inside your query before calling the function. This fixes the error on the fly without changing the stored table data.
Related guides
In this post