Tugger the SLUGger!SLUG Mailing List Archives

[SLUG] MySQL transfer from one host to another over SSH (pull)

Hi everyone!

I'm trying to dump a MySQL DB from one host and import it directly into
another MySQL server using SSH.  The catch is that I want to "pull"
rather than push (which is quite easy).

What I am trying to do is...

        $ ssh DBMASTER "mysqldump --opt -u root -p live" | mysql -u dbuser -p live
        Enter password: remoteuser@DBMASTER's password: 
        ERROR 1045 (28000): Access denied for user 'dbuser'@'localhost' (using password: YES)
But I end up with both password prompts (SSH and MySQL) coming up at the
same time so it fails.

Any SSH gurus out there that can help with this?

Simon Wong <linux@xxxxxxxxx>