ST_AsBinary(g), ST_AsWKB(g)

Converts a value in internal geometry format to its WKB representation
and returns the binary result.

The result is NULL if the geometry argument is NULL. If the argument is
not a syntactically well-formed geometry, an ER_GIS_INVALID_DATA error
occurs as of MySQL 5.7.5. The result is NULL prior to MySQL 5.7.5.

URL: http://dev.mysql.com/doc/refman/5.7/en/gis-format-conversion-functions.html

