Reputation: 18790
How do I import an SQL file to MySQL dump using command line. I am using windows.
Upvotes: 12
Views: 37792
Reputation: 196
Try this
C:\Program Files\Mysql\Mysql server 5.6\bin\mysql -u {username} -p {password} {your database name} < file-name.sql
Note here file-name.sql is in mysql server 5.6\bin
Upvotes: 0
Reputation: 101
Simple steps to import sql file.
Click on WampServer and then go to MySQL=> MySQL console enter password \If no password click simply enter create database database_name; \If database already there skip this step use database_name; source D:\backup.sql \Path of database file
Upvotes: 1
Reputation: 5406
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:
Upvotes: 0
Reputation: 520
To dump all databases, use the -all-databases
option. With that option, no database needs to be specified.
mysqldump -u username -ppassword –all-databases > dump.sql
Upvotes: -2
Reputation: 14568
Navigate to the directory where you have mysql and issue this command, changing the bold values to your file/database locations.
c:\mysql\bin\> mysql -u USERNAME -p PASSWORD database_name < filename.sql
Upvotes: 21