MySQL provide a great command line utility to take backup of your MySQL database and restore it. mysqldump command line utility is available with MySQL installation
Code:
mysqldump –u[user name] –p[password] [database name] > [dump file name]
Example:
mysqldump –uroot –p db_codingcluster > codingcluster.sql
Backup multiple databases in MySQL.
mysqldump –u[user name] –p[password] [database name 1] [database name 2] .. > [dump file name]
Example:
mysqldump –-user root –-p db_first db_second db_third > db_codingcluster.sql
Backup all databases in MySQL.
mysqldump –u[user name] –p[password] –all-databases > [dump file]
Example:
mysqldump –-user root –-p –all-databases > db_codingcluster.sql
How to restoring MySQL database?
To restore the database from the dump file that you can use the following mysql command.
mysql -u [username] -password=[password] [database name] < [dump file name]
Example:
mysqldump –uroot –p db_codingcluster < codingcluster.sql
Please share this post if it's useful to you. Thanks!.