How to copy table1 from host1 to host2:
<?php set_time_limit(0); ini_set('memory_limit', '-1'); $execstring="mysqldump -h host1 -u user1 -ppassword1 databasename TblName | mysql -h host2 -u user2 -ppassword2 anotherDatabase"; $output=""; exec($execstring, $output); ?>
Aware: all the values after pipe (|) must not contain special characters (e.g. !) as they are interpreted by the bash. So escape them.
Backup source and target before testing.