Sometimes, you may not have SSH access to the database server (as in the case of cloud instances such as Amazon RDS). In those cases, you can use mysqldump to take a backup from a remote server to the local server. For this, you need to mention hostname using the --hostname option. Make sure that the user has appropriate privileges to connect and perform a backup:
shell> mysqldump --all-databases --routines --events --triggers --hostname <remote_hostname> > dump.sql