mysql database backup

backup mysql databases

for all databases owned by $user

mysqldump -u $user -p --all-databases > backup.sql

for a single database owned by $user

mysqldump -u $user -p $database > backup.sql

to restore all databases

mysql -u $user -p < backup.sql

to restore a specific database

mysql -u $user -p $database < backup.sql

Read More