The MySql has the ; end of each query, in which case he’s trying to execute two querys rather than one, precisely because the ; is separating.
To prevent this from happening, it is necessary to show MySql what the ; is not finalizing the query and yes it is part of the context, for that there is the DELIMITER, in your case would look like this:
DELIMITER $$
CREATE TRIGGER atualiza_produto AFTER INSERT ON item_venda FOR EACH ROW
BEGIN
UPDATE produto SET vendido = 's' WHERE id = NEW.id_produto;
END
$$
Anything that stands between DELIMITER $$ and $$ shall be executed jointly and not by separating querys each ;.
See more here.
Thanks, it worked! One more thing: would you know how to turn off the Constraints? I need to give Truncate of my entire database before climbing to production but apparently set_checked_constraints = 0 does not work in mysql 5
– Matheus Minguini