Blog

How to export a mysql database using Command Prompt?

The question is how to take backup of mysql database in Windows using Command Prompt?

Answer to this question is explained in following steps.

Step 1: Access mysql bin directory
Step 2: Export the database

Lets start the process…

 

Step 1: Access mysql bin directory

Open the command prompt by pressing Window+r button, run will open. then type cmd which will open command prompt.

Now, we need to be in the mysql bin directory. If you are using Xampp then the directory is

cd C:\xampp\mysql\bin

 

Step 2: Export the database

 

Its time to use below command to export your database:

mysqldump -u YourUser -p YourDatabaseName > wantedsqlfile.sql

You will then be prompted for the database password.

 

Where,

YourUser  – your database username

YourDatabaseName  – your database name

wantedsqlfile – file name of the exported sql file where our database backup will be available

 

Once the execution done, you will get the screen as below

 

This exports the database to the path you are currently in, while executing this command

 

So watch the video for exporting database-

Leave the comment giving feedback. Your feedback is valuable to us.

Happy Learning !

Thank You !

Leave a Reply

Your email address will not be published. Required fields are marked *