为什么我的 mysql 服务器上不存在某些空间函数?

Why some spatial functions does not exists on my mysql server?

我已经安装了一个新的本地 MySQL 服务器(Version8)供开发使用。 我想使用空间函数,但其​​中一些不存在。

这个脚本returns我觉得很值:

create database test;
use test;
select st_x(point(15, 20));

15

所以,虽然空间扩展是本机安装的,但一旦我使用其他功能,如 geomfromtext,我的脚本就会抛出错误:

create database test;
use test;
SELECT geomfromtext('Point(15 20)');

Error Code: 1305. FUNCTION test.geomfromtext does not exist 0.000 sec

我不明白,MySQL Workbench 控制台的自动完成完成了几何图形。

我在安装过程中忘记了哪一步?

我刚刚飞过 MySQL 8.0 中的 official documentation and it seems that the function is called ST_GeomFromText()

In MySQL 5.7, several spatial functions available under multiple names were deprecated to move in the direction of making the spatial function namespace more consistent, the goal being that each spatial function name begin with ST_ if it performs an exact operation, or with MBR if it performs an operation based on minimum bounding rectangles. In MySQL 8.0, the deprecated functions are removed to leave only the corresponding ST_ and MBR functions:

  • These functions are removed in favor of the MBR names: Contains(), Disjoint(), Equals(), Intersects(), Overlaps(), Within().
  • These functions are removed in favor of the ST_ names: Area(), AsBinary(), AsText(), AsWKB(), AsWKT(), Buffer(), Centroid(), ConvexHull(), Crosses(), Dimension(), Distance(), EndPoint(), Envelope(), ExteriorRing(), GeomCollFromText(), GeomCollFromWKB(), GeomFromText(), GeomFromWKB(), GeometryCollectionFromText(), GeometryCollectionFromWKB(), GeometryFromText(), GeometryFromWKB(), GeometryN(), GeometryType(), InteriorRingN(), IsClosed(), IsEmpty(), IsSimple(), LineFromText(), LineFromWKB(), LineStringFromText(), LineStringFromWKB(), MLineFromText(), MLineFromWKB(), MPointFromText(), MPointFromWKB(), MPolyFromText(), MPolyFromWKB(), MultiLineStringFromText(), MultiLineStringFromWKB(), MultiPointFromText(), MultiPointFromWKB(), MultiPolygonFromText(), MultiPolygonFromWKB(), NumGeometries(), NumInteriorRings(), NumPoints(), PointFromText(), PointFromWKB(), PointN(), PolyFromText(), PolyFromWKB(), PolygonFromText(), PolygonFromWKB(), SRID(), StartPoint(), Touches(), X(), Y().

  • GLength() is removed in favor of ST_Length().