Upgrade

Wednesday, 5 June 2013

IMPORTING LARGE SQL DATABASE FILES INTO WAMPSERVER

Hello readers, we are back again with a new solution to you.. Many of you must have used wampserver for creating php website projects and database connections. But here's a problem. if we want to import our project from some other system, you can copy the project files but how to create the same database again. Its quite time consuming and of your database is too large, then its nearly impossible to enter it all again manually. and copy-paste method usually doesn't work as it makes MYSQL CONSOLE unresponsive. So you need not to edit it all. 
We are giving you a method to import your large database siles through command prompt only.

So here is how you go.. 




1.  first, copy the database file ( .sql ) to this path:                       "C:\wamp\bin\mysql\mysql5.1.36\bin "   
  • The number after mysql maychange depending on which version of wamp/mysql do you have.. but in normal cases, it will be only one folder there in mysql folder. so enter it and then go to 'bin' folder and copy the .sql there..
  • also be careful that your database file is saved as a .sql file only. 
 2. Now, open the command prompt from Start>All Programs>Command Prompt. you may have to right click on it's icon and click "Run As Administrator" so you just be in safe without problems...

3. If you opened the command prompt, type there
          " CD C:\wamp\bin\mysql\mysql5.1.36\bin "
  • Note the space after CD in the begining, then hit enter
          (This should change the directory on the command prompt to that directory)

4. Now prepare for the command, you will need the datebase name ( you must created it before ), and the database username ( default for wamp is root ) and database password ( default for wamp is nothing, no password is set )

Type the following command::

mysql -u [DATABASE_USERNAME] -p [DATABASE_NAME] < [DATABASE_FILE.SQL]
 

  • Replace the brackets with the correct values, for example if your database name is PROPERTY and the sql file is property.sql and you use the default username and password for the database then the line will be
          mysql -u root -p property < property.sql

After that hit enter.. it will ask you the password, if it's empty just hit enter again or type it then enter.. then it will restore the db.. for a db with a large size it will take seconds only.




So try it and enjoy computing.. :)