How to limit schema size by a trigger The problem:
I am running on a Webhotel a MySql database with different schemas with a maximum size limit on each schema. I can't change any settings on the DBMS. To be able to keep the schema below the max size i can remove the oldest rows to make space for newer ones, like a LIFO.

The only way to do this I thought was making a trigger. I'm trying to make one like this:

CREATE TRIGGER inventoryproposalprocessed_AINS AFTER INSERT ON iventoryproposalprocessed
    FOR EACH ROW
    BEGIN
      DECLARE size INTEGER;
      SELECT sum( data_length + index_length ) / 1024 / 1024 INTO size FROM information_schema.TABLES where table_schema like 'd40013_x_frodo' ; 
      IF size &gt; 99 THEN  
         DELETE FROM inventoryproposalprocessed order by _id limit 25;
      END IF; 
    END; 


But it doesn't work. How should a trigger like that look like?
You cannot change the rest of rows on table with its own trigger- that is by design. Check this answer.

That also provides an alternative method: disable the INSERT privileges on that table and allow inserting only by using a stored procedure, that will do as you want (although I do not like much the logic behind it):

CREATE PROCEDURE insert_inventoryproposalprocessed (...required input values...)
    BEGIN
      INSERT INTO inventoryproposalprocessed VALUES (...input variables...)
      DECLARE size INTEGER;
      SELECT sum( data_length + index_length ) / 1024 / 1024 INTO size FROM information_schema.TABLES where table_schema like 'd40013_x_frodo' ; 
      IF size &gt; 99 THEN  
         DELETE FROM inventoryproposalprocessed order by _id limit 25;
      END IF; 
    END;