MYSQL Backup Command
Backup is important for us. We should configure automatic backup on our server. Sometimes we want to take quick backup so we can do it from command. It’s also helps to take backup of large database size.
The most straight forward method to create backup of the MySQL database management system uses the mysqldump utility from the command line.
If you want to take back up a single database, you can create the dump and send the output into a file, like so:
mysqldump databasename > databasename.sql
Similary you can back up all of the databases on a server.You should use the –all-databases option
mysqldump --all-databases > alldb_backup.sql
You can restore the database backup by telling mysql to run the commands in it and put the data into the proper database.
mysql databasename < databasename.sql
In the above code, databasename is the name of the database you want to restore, and databasename.sql is the name of the backup file to be restored.