There are a number of ways to automatically backup MySQL databases, the simplest one is just to use the mysqldump program and schedule a cron job.
The mysqldump program typically produces an SQL file which can used to restore any where between one to all databases on a server.
Running the mysqldump program is done using the following command:
mysqldump [OPTIONS] (Database name or list of databases)
NOTE: You can use --all-databases in the place of a single or list of database
names to backup all the databases in one file!
Whilst there are a large number of options to give the program the most important ones are probably the “username” and “password” ones.