Filed under:

How to Backup your MySQL DB databases




Backup command for mysql databases

For those looking to get a regular backup of your MySQL database, the command to add as a cron.job ...

/usr/bin/mysqldump -u{mysql_username} -p{mysql_password} {mysql_db_name} |gzip |uuencode {mysql_db_name}backup.sql.gz |mail -s "database backup" {emailaddress}

replace :

  • {mysql_username} with the database owner username
  • {mysql_password} with the database password
  • {mysql_db_name} with the database name
  • {emailaddress} with your email address

Please only add the backups as jobs *after* 2am to keep load down on the server duriung peak hours, and be warned it will use up your bandwidth/data-transfer allocation quickly, so weekly backups are recommended over daily ones if your DB is relatively static.



Was this answer helpful?

Add to Favourites Add to Favourites    Print this Article Print this Article

Also Read
article icon Cron Cheat Sheet (Views: 2883)

Language: