On 19/06/07, Michael Chesterton <[EMAIL PROTECTED]> wrote:
Simon Wong <[EMAIL PROTECTED]> writes:
> What I am trying to do is...
>
> $ ssh DBMASTER "mysqldump --opt -u root -p live" | mysql -u dbuser -p
live
> Enter password: [EMAIL PROTECTED]'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?
You can get rid of the password prompts.
You can specify the MySQL password on the command line with
"--password=supersecret" (not recommended if you have untrusted users
on that system - it'll be visible to "ps").
Another option (especially if you want to do this regularly) might be
to setup a MySQL user which can do this particular operation and allow
only root to login to that MySQL user without a password. I'm not sure
about the details but dig around, there is tons of documentation about
MySQL.
You can get rid of the ssh password prompt by using private/public keys.
(see "ssh-keygen", "ssh-copy-id", "ssh-agent").
---Amos
--
SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/
Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html