Taking the backup of the database is necessary whether it small or large projects. You can easily revert the database if something went wrong.
Using phpMyAdmin you can easily export your MySQL database but it got cancel if it exceeds the max defined time.
You can also Command Line to export selected MySQL database.
In this tutorial, I am using XAMPP in windows.
1. Export Database
- I am exporting
tutorialdatabase using Command-Line.
- For this open Command Prompt.
- Navigate to
- Execute following command –
mysqldump -u username -p database-name > export-file-name.sql
username – MySQL username.
database-name – Database name which you want to export.
export-file-name.sql – Specify you export file name.
mysqldump -u root -p tutorial > tutorial.sql
Here, I am exporting
tutorial database and set export file name –
It will ask for a password.
Enter the user password if you have defined otherwise press enter.
A new SQL file will createÂ in the
You can either export your MySQL database using phpMyAdmin or Command-Line.
The SQL file stored in
xampp/mysql/bin/ directory if you have used the command line.
With Command-Line you can also import SQL file in your MySQL database.
If you found this tutorial helpful then don’t forget to share.