When using MySQL in batch mode, you may often find it useful to use
the UNIX shell commands along with the SQL queries. This is a
demo script showing how you can achieve that:
# Mixing shell commands and SQL queries in batch mode- demo script use test; #INSTALL PLUGIN example SONAME 'ha_example.so'; #Ignore statement system cp /tmp/mysqld.trace logs/init.trace # Shell commands prefixed with a 'system' create table new4(num integer) engine=EXAMPLE; system cp /tmp/mysqld.trace logs/after_create.trace # Shell commands prefixed with a 'system' system diff logs/init.trace logs/after_create.trace # Shell commands prefixed with a 'system'
This script makes use of the 'system' command:
system (\!) Execute a system shell command.
Note that this is available only on UNIX systems.