Why do this?
In case you don’t have shell access to your server from your hosting provider. Also if the provider doesn’t let you writing files locally from a script.
If you want to backup from a remote machine to your local machine:
(Don’t use the symbols when you type it, except the last > that redirects to a file.)
mysqldump --opt -Q -h -u --password= >
If you want to backup from a remote machine to that same remote machine.
mysqldump --opt -Q -h -u -p >
You can also pipe that to gzip to compress, and schedule it as needed.