You can easily take Backup of Database by using the following Command Line :

For Single Database :

mysqldump db_name > db_name.sql

For more than One Database :

mysqldump --databases one_database two_database > twodatabases.sql

For all the Databases :

mysqldump --all-databases > alldatabases.sql

You can easily Restore the MySQL Backup by using the following Command Line :

For Restoring Single Backup :

mysql db_name < db_name.sql

For Restoring Single Database from all Backup :

mysql --one-database db_name < alldatabases.sql

If you want to Backup all Databases in the Server as different-SQL files then use following :

This process will create a backup of all the available Databases on the Server and then it will create a zip all the created SQL files and will save the zipped file to the location /backup. Backup of all the databases will be available in the location /backup and the format will be databasename.sql.gz.
for db in `echo 'show databases;' |mysql |grep –Ev
"Database|information_schema|performance_schema"`; do mysqldump $db | gzip > /backup/$db.sql.gz ;done

 

Was this answer helpful? 0 Users Found This Useful (0 Votes)