16

I tried importing my yyy.sql file ( a large file) into xxx database through wampserver. I copied yyy.sql file to C: drive and through mysql console mysql> use xxx mysql>source C:\yyy.sql

when I execute these commands it seems its reading each row. after that it gives mysql> and when I check the xxx database it's showing empty. what's wrong?

5
  • did you try phpMyAdmin in wamp ? you can also import sql there. Commented Oct 11, 2014 at 2:32
  • yeah.. since its a large file I am importing through console window. Commented Oct 11, 2014 at 2:41
  • in you post you didnt connect to mysql with username password and host? mysql -u {DB-USER-NAME} -p {DB-NAME} < {db.file.sql path} Commented Oct 11, 2014 at 2:45
  • To Import a large file through phpMyAdmin Find the config.inc.php file located in the phpmyadmin directory. In my case it is located here: 1 C:\wamp\apps\phpmyadmin3.2.0.1\config.inc.php 2 Find the line with $cfg['UploadDir'] on it and update it to: 3 $cfg['UploadDir'] = 'upload'; 4 Create a directory called ‘upload’ within the phpmyadmin directory. 5 C:\wamp\apps\phpmyadmin3.2.0.1\upload\ Then place the large sql file that you are trying to import into the new upload directory. You can now import. Commented Oct 11, 2014 at 2:49
  • Sadly, after giving php.ini gigabytes of max file size and memory, it imported no faster than a regular SQL import. I wouldn't reocmmend PhpMyAdmin unelss you're only deal with a smallish database. I cannot recommend the command line solution below enough, I can import hundreds of megabytes of SQL data a minute. (500MB takes less than 2 minutes) Commented Aug 6, 2019 at 9:27

2 Answers 2

41

Option 1; PHPMyAdmin

1. left click wamp -> phpmyadmin
2. select database then click import (top right)
3. locate the database and click go.

Option 2; Using the command line.

The easiest way to import a sql file into a database in WAMP, using command line is as follows:

1. Open Command Prompt (CMD - DOS) get into the mysql folder, which in my case works like this
C:\> cd C:\wamp\bin\mysql\mysql5.0.51b\bin

2. Then use this command to fire up MySQL
   This line basically connects you to the mysql database of your choice.
   (-p for password if you have one)
C:\wamp\bin\mysql\mysql5.0.51b\bin> mysql.exe -use databasename -u username -p

3. To make things easier, copy the SQL file into the same folder as mysql.exe, and then run this
mysql> source myfilename.sql;
Sign up to request clarification or add additional context in comments.

8 Comments

when I use mysql>show tables; in console its clearly showing tables what I needed but through a browser localhost/phpmyadmin in xxx database its empty
have you tried to create a new table in the database in phpMyAdmin ? or try to repair database with the command mysqlcheck -r databasename and check if that fix the problem.
It can also be a predefined USER issue. may be that user is not present in your phpMyAdmin try to check it IMPORTANT
I followed the method you mentioned through cmd.After last step the window kept giving lines "Query OK, 1 row affected<0.00 sec>" when I check the xxx database its showing only a sample table which I created through phpMyAdmin as you mentioned. Its not showing the file I imported. :'(
Or is there a method like directly pasting the sql file in database folder ??
|
-2
  1. OPEN your filename.sql in NOTEPAD.....

  2. COPY all content..... left

  3. Click wamp>phpmyadmin.....

  4. CREATE new Database.....
  5. and Click on SQL tab and PASTE the content.....
  6. then Click on GO..... Hurray!

    you have done

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.