Backing up a MySQL database

Here is information on mysqldump, showing examples for individual and all databases:

So, you could put this in a cron job:
> mysqldump -h localhost -uusername -ppassword databasename > databasename_backup.sql

If you want to do remote backups, create a new user in MySQL with select permissions only that can be accessed from the remote machine, and substitute localhost with the correct domain.

  • dislocate