Comments - Executing a command file from within a command file?
Content reproduced on this site is the property of its respective owners,
and this content is not reviewed in advance by MariaDB. The views, information and opinions
expressed by this content do not necessarily represent those of MariaDB or any other party.
Thanks for the reply. Yes, I want to do this. But this file has to be executed by the MySQL command client (in a logged in session). So, how do you execute a file containing many commands from the MySQL client?
John D.
I'm not sure I understand the difficulty? You'll need to create a file, for example, "commands.sql" containing all the SQL instructions. Then, if you're logged into the mysql client, run "source commands.sql". Or, if you're not logged in, pass commands.sql from the command line. As long as commands.sql contains all the SQL commands you want, there's just one instruction.
cat commands.sql | mysql