== Database dumps ==
Refer to [[SQL Snippets]] for more quick commands regarding SQL databases. Add a new user with a complicated password and minimal permissions to all databases with the following SQL command.
grant lock tables,show view,select on *.* to 'archive'@'localhost' identified by 'CHANGEMETOSOMETHINGSECURE';
We store scripts in <code>/usr/local/scripts</code> but you can put them wherever. This one is named <code>/usr/local/scripts/pre-acts.sh</code>. It simply dumps all databases to a backup SQL file for tarsnap to ingest.
chown 0:0 $DUMPFILE
chmod 600 $DUMPFILE
mysqldump -u archive -pCHANGEMETOSOMETHINGSECURE --all-databases > $DUMPFILE