How to Backup a MySQL Database

Backup a Single and All the MysQl Databases.

Single database:
mysqldump -u root -pmypasswd vishalvyas > /opt/vishalvyas.sql

Restore:
mysql -uroot -pmypasswd vishalvyas < /opt/vishalvyas.sql


To back up all databases on a particular server, use the mysqldump command:
 
Backup all the databases:
mysqldump -u root -pmypasswd --all-databases > /opt/alldatabase.sql

Restore:
mysql -uroot -pmypasswd < /opt/alldatabases.sql


















Thanks,
Vishal Vyas