I want to import an SQL file (size > 500MB) into a database. I have wamp on my PC. Phpmyadmin does not work well with this size. I changed all parameters in php.ini (max_upload_
If you are running WampServer on your local machine, import means restoring the dump file that you have (in sql format)
Here are the steps
Change the directory to Mysql bin directory. It will be like
c:\wamp\bin\mysql\mysql5.7.14\bin
It would be better to keep the dump file in the above directory( we can delete, after restoration)
Hope you have created the database (either through phpMyadmin or using command line)
Then type the command mysql.exe -u root -p databasename < filename.sql
Please note the difference, it is 'mysql.exe' not 'mysql'
First open Your cmd pannel And enter mysql -u root -p (And Hit Enter) After cmd ask's for mysql password (if you have mysql password so enter now and hit enter again) now type source mysqldata.sql(Hit Enter) Your database will import without any error
To import database from dump file (in this case called filename.sql)
use: mysql -u username -p password database_name < filename.sql
you are on Windows you will need to open CMD and go to directory where mysql.exe is installed. you are using WAMP server then this is usually located in: C:\wamp\bin\mysql\mysql5.5.8\bin (*note the version of mysql might be different)
So you will: cd C:\wamp\bin\mysql\mysql5.5.8\bin
and then execute one of the above commands. Final command like this
C:\wamp\bin\mysql\mysql5.5.8\bin>mysql -u rootss -p pwdroot testdatabasename < D:\test\Projects\test_demo_db.sql
Try like this:
I think you need to use the full path at the command line, something like this, perhaps:
C:\xampp\mysql\bin\mysql -u {username} -p {databasename} < file_name.sql
Refer this link also:
http://www.ryantetek.com/2011/09/importing-large-sql-files-through-command-line-when-using-phpmyadminxampp/
I use mysql -u root -ppassword databasename < filename.sql
in batch process. For an individual file, I like to use source
more because it shows the progress and any errors like
Query OK, 6717 rows affected (0.18 sec)
Records: 6717 Duplicates: 0 Warnings: 0
mysql -u root -ppassword
In MySQL, change the database you want to import in: mysql>use databasename;
Import the SQL file using source command: mysql>source path\to\the\file\filename.sql;
To import SQL file what works for me
For Wamp-Server
- Find mysql in wamp. In my computer it's location is "C:\wamp64\bin\mysql\mysql5.7.21\bin"
Open cmd and once you get inside bin you have to write " mysql -uroot -p database_name < filename.sql"
remember to put sql file under bin.
in nutshell you have to do this:-
C:\wamp64\bin\mysql\mysql5.7.21\bin>mysql -uroot -p database_name < filename.sql
After this, it will ask for the password, mine password was nothing(BLANK).
hope it helps someone.