rsync mysql

I am using rsync to get my file updates from my Linux VPS to local Windows PC. For this I use the account I have setup for my websites: let say
In order to get to /var/lib/mysql/ directory I need to escalate that user's privileges to SU when using SSH.
When I do rsync for my web content, the user webadmin is fine because it owns the web directory.
Now when I want to get to mysql files, webadmin has not the permissions to get them:
rsync -u -rvz -e 'ssh -p 22' --progress /mysql

If I run:
rsync -u -rvz -e 'ssh -p 22' --progress /mysql
The server does not allow to login as root.

I created rsa and dsa keys and have put the public ones in the authorized_keys file on the server in order to login w/o password.
For this purpose I have have changed the sshd_config to allow PubkeyAuthentication, PermitRootLogin and RSAAuthentication.

Have set the .ssh permission to 700 and all beneath to 600.
Now, when I run (using cygwin):

rsync -vcr -e "ssh -l root -i /cygdrive/c/cygwin64/home/user123/.ssh" "myserver:/var/lib/mysql/" "/cygdrive/c/backup/mysql"

it still prompts me for password...
What am I doing wrong?
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Can you log into mysql with admin authority? If so, you can backup your entire database with a command similar to this:

mysqldump -uUSERNAME --all-databases --skip-lock-tables -pPASSWORD -c

Open in new window

nerkoniAuthor Commented:
Yes, I have done this. Then I have to copy the file to a location under webadmin privileges and as last I have to do SFTP download or rsync. I would like to be able to to it with one rsync command and maybe zip it up all at once so I don't have to do the additional steps.
Perfectly one rsync command or a script maybe to backup all individual databases, wrap then into a zip file and download to local PC. Is it possible?
On linux one would SSH to remote host and just pipe compressed mysqldump output to local system's file.
10 Tips to Protect Your Business from Ransomware

Did you know that ransomware is the most widespread, destructive malware in the world today? It accounts for 39% of all security breaches, with ransomware gangsters projected to make $11.5B in profits from online extortion by 2019.

nerkoniAuthor Commented:
Could you give an example command?
ssh user@remotehost mysqldump --all-databases | gzip -1 > dump.gz

assuming mysql root password is saved in .my.cnf for that remote user.
nerkoniAuthor Commented:
This works saving the file ON server. What do I do to get it to local PC? See my first post...
Install cygwin putty plink and it works on your local PC
nerkoniAuthor Commented:
I am using both, cygwin and putty. Have to do several steps to get the backup. Here is what I do:

1. ssh login with myuser and escalate to root
2. run: mysqldump -u root -p --all-databases | gzip -1 > Alldb_20150617.gz (enter pswd for mysql root user)
3. run: chown myuser:myuser Alldb_20150617.gz
4. download Alldb_20150617.gz via SFTP

How could I shorten this process?
Hard to understand purpose of "escalate to root" in your sequence.

I am sorry but I will NOT repeat perfectly working example .http:#a40830862
nerkoniAuthor Commented:
Means I cannot login as root. Must login as user with less privileges and do "sudo su" in order to do next step.
I changed some config which should allow to login w/o password using my private key (public added to server) but for some reason I am not able to since it prompts me for password again...
I posted one single command line. Please use it.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.