The following will dump a DB onto my machine from a remote machine (and also gzips):
ssh root@foo.com "mysqldump -u root -p db_name | gzip -c" > dn_name.sql.gz
How come the host password is hidden correctly but the password entry for mysql is clear text?
Thanks :).
Because if you enter a password non-interactively in a shell, it can always be seen by other users in the process tree.
If you are running the process as root anyway, then root user should itself secured enough, so you should make no-password-required dumping available for the root user.
Another option is creating a
.my.cnffile in the home directory, make it only readable and writeable by root (chmod 600).Here are the contents of the said
.my.cnffile:This way the user and password should be entered automatically without the chance of being compromised.