I wish to backup two tables: table1 and table2.

table1 comes from database database1.

table2 comes from database database2.

It is possible to method to dump all of them with just one mysqldump call?

I understand I'm able to do:

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

But exactly how to dump two tables from different databases?

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

The syntax is:

mysqldump --databases db_name1 [db_name2 ...] > my_databases.sql

Look for reference: http://dev.mysql.com/doc/refman/5.1/en/mysqldump.html

Hope it will help

You will find three general methods to invoke mysqldump:

shell> mysqldump [options] db_name [tbl_name ...]
shell> mysqldump [options] --databases db_name ...
shell> mysqldump [options] --all-databases

Only the first allows you choose the database and table title, but does not allow multiple databases. If you are using the 2nd or third option you'll dump the chosen databases (second) or all databases (third).

So, it can be done but you will need to dump to entire databases.

As MichaƂ Powaga mentioned within the comments, you could also get it done two times.

very first time with "> /tmp/file.sql"

second time with ">> /tmp/file.sql to append"