自动备份数据库的最佳方法

I have a local server XAMPP I want to know if there is any way to auto backup my databse

Try using cron and mysqldump. I think this is the most simple way to achieve your goal. http://dev.mysql.com/doc/refman/5.7/en/mysqldump.html

Use daily crontab job if you are using Linux

0 0 * * * /path/to/mysqldump ... > /path/to/backup/mydata_$( date +"%Y_%m_%d" ).sql

Easiest setup:

Set up a cronjob to do a mysqldump

0 0 * * * /usr/bin/mysqldump -u <username> -h localhost -p"<password>" <database> > /path/to/backup.sql