Copy mysql database from remote server to local computer

mysql

Solution

Assuming the following command works successfully:

mysql -u username -p -h remote.site.com

The syntax for `mysqldump` is identical, and outputs the database dump to `stdout`. Redirect the output to a local file on the computer:

mysqldump -u username -p -h remote.site.com DBNAME > backup.sql

Replace `DBNAME` with the name of the database you'd like to download to your computer.

Problem

I'm under VPN and I don't have SSH access to remote server. I can connect to remote database by console ``` mysql -u username -p -h remote.site.com ``` Now I'm trying to clone the remote database to local computer ``` mysqldump -u username -p -h remote.site.com mysqldump | mysql -u root -ppassword webstuff ``` And I've got error ``` mysqldump: Got error: 1045: Access denied for user 'webstaff'@'10.75.1.2' (using password: YES) when trying to connect ``` How to copy mysql database from remote server to local computer?

Original source

Related problems