Simple MySQL Command line DB dump for cron
If it doesn't already exists, create the file .my.cnf in your home directory.
Add the following to it, replacing db_username and db_password with the database username and password. make sure the file permissions are set to 600 (chmod 600 .my.cnf) so it is readable by you alone.
[mysqldump]
user=db_username
password=db_password
The following command will dump the database db_name to the db_backups directory with the filename yyyymmdd.sql where yyyy is the current year, mm is the ...