0

Question:

Please can anyone tell me, How to import mysql database through command prompt

Note:

I am beginner in mysql database

ramkumar
  • 1
  • 1
  • 7
  • Check http://stackoverflow.com/questions/17666249/how-to-import-a-sql-file-using-the-command-line-in-mysql – gncvnvcnc Sep 10 '14 at 08:02

3 Answers3

2

For Import Database in Phpmyadmin using cmd with process

C:>cd xampp

C:\xampp>cd mysql

C:\xampp\mysql>cd bin

Go to directory where you have mysql. -u - for username -p - to prompt the password

mysql -u username -ppassword databasename < file.sql

Note:It is better to use full path of the the sql file file.sql

To import database from dump file (in this case called filename.sql) use: mysql -u username -p password database_name < filename.sql

If you are on Windows you will need to open CMD and go to directory where mysql.exe is installed. If you are using WAMP server then this is usually located in: C:\wamp\bin\mysql\mysql5.1.36\bin (*note the version of mysql might be different)

So you will: cd C:\wamp\bin\mysql\mysql5.1.36\bin

and then execute one of the above commands.

Tanmay Patel
  • 1,770
  • 21
  • 28
0

Try This

mysql -u username -p[******] database_name < mysqlfile.sql

For more details for export and import database please click here.

  • The above solution works great. There is another way where you do not provide password after -p: mysql -u [username] -p [db] < [path to sql file] when prompted, you need to provided the password – Bhavin Joshi Dec 03 '14 at 06:20
0
mysql -u username -p database_name < dump.sql

You will then be prompted for the database password. Enter it and that's it. :)

sloppypasta
  • 1,068
  • 9
  • 15