How to import and export mysql database


       Exporting mysql database


Step 1 : Go to drive C: and create a folder (say ‘folder’).

Step 2 : Go to MySQL folder in C:\Program Files\MySQL and go to bin folder and copy the address.

Step 3 : Search for cmd.

Step 4 : Right click on cmd icon and open with run as administrator option.

Step 5 : Write cd and paste the copied bin address and press Enter.

Step 6 : Now write| mysqldump -h 127.0.0.1 -u root -p {database name} >c:\ {folder name, say                       "folder"} \ database.sql

( database.sql is the name of exported sql file so you can also use diffrent names .)

Step 7 : cmd asks for your mysql password if you set your password then enter that otherwise press                  enter key

( you can see your mysql database file in the folder created by you )




Importing mysql database

Step 1 : Open mysql

Step 2 : Create a new blank database of name that you wanted to give to your database.

Step 3 : Go to MySQL folder in C:\Program Files\MySQL and go to bin folder and copy the address.

Step 4 : Search for cmd.

Step 5 : Right click on cmd icon and open with run as administrator option.

Step 6 : Write cd and paste the copied bin address and press Enter.

(create a folder in c drive and paste your mysql database file in that folder that you want to import )

Step 7 : Now write| mysql -h 127.0.0.1 -u root -p {database name that you given in step 2} <c:\                        {folder name where your database file is located} \ database.sql

(database.sql is the name of mysql database file if your file have any diffrent name so you write that name with .sql extension)

Step 8 : if cmd asks for your mysql password , if you set your password then enter that otherwise                      press enter key

( you can check in mysql that your database is imported )



Note : Do not use curly braces {} in your query it is just for your explanation.

how to import export mysql database