I have a script that starts with "START TRANSACTION", alters tables, inserts in others, and ends with "COMMIT"
However, I am executing this script using:
mysql -u root --password="jajaja" my_schema < ./my_script.sql
The problem is that if there is an error in any line mysql exits and the transaction is not rollback. If I use --force then the execution continues to the "COMMIT" but it did not rollback on error.
How can I tell mysql to perform a rollback if an error happened while executing my script?