Shell and MySQL

From Shrubbery

Jump to: navigation, search


Shell/MySQL tips

[edit] Using a 'Here document' with MySQL

If you want to execute a bunch of MySQL commands but you don't want to write a temporary SQL script file, you can use a Here Document:

mysql -u$DB_USER -p$DB_PASS -h$DB_HOST $DB_NAME <<END_SQL
... sql commands ...
END_SQL
Personal tools