Take MySql database Backups remotely from command line

If you are a developer it is obvious that you take frequent backups of the project you develop.  If you are a web developer chances are that you always login to cpanel or some other dashboard provided by your hosting provider to take backups. Some tools provide scheduled backups on server.  This is fine if database is small. But if database is big or if you have many databases , this process gonna take large amount of space on your server. To free space you need to download to your computer and delete remote backups.

If you are this stage and you are searching for better alternative this is the one line command that can save you some time.

 

mysqldump --host=[hostname] --opt --user=[username] --password=[passwod] [database] --add-drop-table   -r  C:\path\on\your\computer\back-up-name.sql

You can take help of scheduler on your computer to take periodic backups of the database on store them on your computer. This way you can save lot of time. remote MySql need to be enabled in few hosts for this scripts to work. Also if mysql environment variable is not set you need to navigate to that folder and run command for this to work.