MySQL Backup DB

Backing up data.

MySQL Backup Database

Backing up a database is crucial for data safety.

MySQL does not have a built-in SQL command like BACKUP DATABASE that works inside a query window (like T-SQL does).

Instead, the general way to backup a MySQL database is to use the mysqldump utility from the command line.

mysqldump Syntax

mysqldump -u username -p databasename > backup_file.sql

This creates a SQL file containing all the SQL commands needed to recreate the database.

Example

mysqldump -u root -p myDB > myDB_backup.sql