How to import and export mysql database using Command Prompt?

                                  If you have a large database and you want to export which is not exported by phpmyadmin default export option. because it shows some maximum limit or time expired. For that you can try importing and exporting any size database of phpmyadmin using Command prompt.

So command for importing and exporting is below : 

       1. open cmd
       2. set mysql path in cmd

            set path=c:\wamp\bin\mysql\mysql5.6.17\bin

       3. For database export (Backup)
           
           mysqldump -u YourUser -p YourDatabaseName > filename.sql

       4. For database import (Restore): 

            mysql -u YourUser -p YourDatabaseName < filename.sql



you can change your set path command as per your xampp,wampp etc.

No comments:

Post a comment

If you have any doubts regarding the post. Please let me know.