This is small tip to help you backup all database mysql by one command. And you also can use this command to backup database every night.
Using the command below:
1 |
date=`date -I`; mysqldump -u yourusername -p yourpassword --all-databases > /home/LOGIN/backups/xbackup_$date.sql; gzip /home/LOGIN/backups/xbackup_$date.sql |
Or using crontab to backup database every day:
1 |
0 5 * * * date=`date -I`; mysqldump -u root -p'yourpass' --default-character-set=utf8 --databases yourdatabase> /home/backups/xbackup_$date.sql |