Mysqldump tables from different databases

databaseMySQLmysqldumpsql

I want to backup two tables: table1 and table2.

table1 is from database database1.

table2 is from database database2.

Is there a way to dump them with a single mysqldump call?

I know I can do:

mysqldump -S unixSocket --skip-comments --default-character-set=utf8 --databases database1 --tables table1 > /tmp/file.sql

But how to dump two tables from different databases?

Best Answer

Use mysqldump twice but second time with redirect to file as append >> /tmp/file.sql.