シェル内でヒアドキュメント
cat << _EOT_ > /tmp/sample.sql
SELECT
table_schema,
table_name,
current_timestamp as wtime
from
information_schema.tables
where
table_schema = 'information_schema' ;
_EOT_
パイプで実行する例
cat /tmp/sample.sql | mysql -u root -p
リダイレクトで実行する例
mysql -u root -p < /tmp/sample.sql
コマンド入力をヒアドキュメント化
mysql -u root -p << _EOT_
SELECT
table_schema,
table_name,
current_timestamp as wtime
from
information_schema.tables
where
table_schema = 'information_schema' ;
_EOT_