It’s good security practice to have a separate “backup” user that only has global read privileges.
The minimum privileges required to accomplish this are:
- LOCK TABLES
- SHOW DATABASES
- SHOW VIEW
After setting up your new user, you can run:
mysqldump --all-databases -u backup -p > sqldump.sql
..to backup all your databases to the file sqldump.sql!
Check out my CentOS tutorial for information on how to set automatic database backup via CRON. (Step 15 in the guide.)