      @cached_property
      def is_mysql_5_6(self):
          return self.connection.mysql_version < (5, 7, 6)
  
      @cached_property
      def select(self):
          if self.is_mysql_5_5:
              return 'AsText(%s)'
          return 'ST_AsText(%s)'
 
</s> remove             if spatialite or mysql or oracle:
 </s> add             if spatialite or (mysql and not connection.ops.uses_invalid_empty_geometry_collection) or oracle: </s> remove from django.contrib.gis.db.models import aggregates
 </s> add from django.contrib.gis.db.models import GeometryField, aggregates
    @cached_property
    def uses_invalid_empty_geometry_collection(self):
        return self.connection.mysql_version >= (5, 7, 5)

      @cached_property
      def is_mysql_5_6(self):
          return self.connection.mysql_version < (5, 7, 6)
  
    @cached_property
    def uses_invalid_empty_geometry_collection(self):
        return self.connection.mysql_version >= (5, 7, 5)

      @cached_property
      def select(self):
          if self.is_mysql_5_5:
              return 'AsText(%s)'
          return 'ST_AsText(%s)'
keep keep keep add keep keep keep keep keep
 Refs #26657 -- Fixed a crash induced by invalid WKT returned by MySQL 5.7.5+. 
django/contrib/gis/db/backends/mysql/operations.py