Reputation: 31020
I have a large MySQL file that I need to execute statements from I also need to SET autocommit=0
before and COMMIT
after executing this MySQL file.
I don’t want to create or modify files.
Is there a way to execute all 3 of them in one or multiple lines in a bash script?
Upvotes: 0
Views: 629
Reputation: 780974
{ echo "SET autocommit = 0;"
cat filename.sql
echo "commit;" ; } | mysql
Upvotes: 1