How To Import Database From Command Prompt

When a database size is very big and then you are trying to import it using mysql. Then it can't be imported it display several errors like "MySQL server has gone away obstructing import of large dumps" or "Exceeds Max Allowed Packet for MySQL" or some thing else. 
The easy solution to resolve these errors you have to import your data threw command prompt. Below is the steps to import database using command prompt :-




Steps :

1- Run command Prompt By ctrl+R if your operating system is window.

2- Go to bin folder of mysql in your server. In my scenario i installed wamp server in C drive.

C:\wamp\www\bin\mysql\mysql5.5.24\bin\

Command Syntax :

   C:\wamp\www\bin\mysql\mysql5.5.24\bin\mysql -u -p databaseName < pathOfYourSqlFileYouWantToImport >


Example :

C:\wamp\www\bin\mysql\mysql5.5.24\bin\mysql -u root -p careyguides < d:/carey_guides.sql  

Now press enter and then its ask your database password. In my scenario my database username is root and password is blank so i simply press enter again with out typing anything.


If you like this post please don't forget to post a comment for appreciation.

Chears .. Happy Coding guys :)

Post a Comment

Previous Post Next Post