Import SQL file by command line in Windows 7
Solution 1
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:
Solution 2
If you have wamp installed then go to command prompt , go to the path where mysql.exe exists , like for me it was : C:\wamp\bin\mysql\mysql5.0.51b\bin , then paste the sql file in the same location and then run this command in cmd :
C:\wamp\bin\mysql\mysql5.0.51b\bin>mysql -u root -p YourDatabaseName < YourFileName.sql
Solution 3
To import database from dump file use:
mysql -u UserName -p Password DatabaseName < FileName.sql
In wamp
C:\wamp\bin\mysql\mysql5.0.51b\bin>mysql mysql -uroot -p DatabaseName < FileName.sql
Solution 4
----------------WARM server.
step 1: go to cmd go to directory C:\wamp\bin\mysql\mysql5.6.17 hold Shift + right click (choose "open command window here")
step 2: C:\wamp\bin\mysql\mysql5.6.17\bin>mysql -u root -p SellProduct < D:\file.sql
in this case
+ Root is username database
+ SellProduct is name database.
+ D:\file.sql is file you want to import
---------------It's work with me -------------------
Solution 5
TRY THIS
C:\xampp\mysql\bin\mysql -u {username} -p {databasename} < {filepath}
if username=root ,filepath='C:/test.sql', databasename='test' ,password ='' then command will be
C:\xampp\mysql\bin\mysql -u root test < C:/test.sql
![Napster](https://i.stack.imgur.com/Z6xX5.jpg?s=256&g=1)
Napster
I am a India based php developer with 3 years commercial experience in PHP/MySQL – (LAMP/WAMP) and PHP-Oracle. Strong knowledge of ADODB database layer. Knowledge of PHP frameworks - Zend, Codeigniter, Yii, Cake. I have very good commercial experience in analysis, design, development, testing and implementation of web applications. Selfmade and good communicator which help me to work with clients at all levels of the business. All my current work is developed using the latest version of PHP and MySQL and my code is upto the current standards and secure.
Updated on July 09, 2022Comments
-
Napster about 2 years
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_size etc.). But it does not work for me. So I want to import it by command line.
I used these commands for import the file:
mysql -u root -p sysdat < D:\Nisarg\ISPC\Database\sysdat.sql mysql -u root -p -D sysdat < D:\Nisarg\ISPC\Database\sysdat.sql mysql -u root sysdat < D:\Nisarg\ISPC\Database\sysdat.sql -p
These all are not working.