Site backup
We already mentioned three crucial elements that must be backed up in order to have a safeguard against site crashes.
Database
Database backup consists of exporting database structure (tables) and data. Export can be in some proprietary format or as a standard SQL script. Since our focus was on MySQL database we will explain the process for that Relational Database Management System (RDBMS). If you happen to use another RDBMS consult the vendor documentation for the appropriate export procedure.
MySQL comes with variety of command-line tools mostly for administrative purposes. The tool for exporting database is called mysqldump
. This is a recommended template command line for exporting a single database from MySQL assuming that the command is being executed on the server where the database is running.
mysqldump -u<username> -p<password> --opt --result-file=<output file> <database name>
Using our values for the Linux, setup export would look like this...