views:

197

answers:

2

I have a file, db.sql. I have tried to import it using: mysql -uroot -p[password] db < db.sql

All I get is a listing of mysql commands, or I get a syntax error. The weird thing is I used this file last week and, as far as I know, I'm doing it the same way.

I create the database, then in command line enter the above but it's not working. I've tried being inside mysql and just at command line and nothing seems to be working.

Is there something I should be doing different in windows or mysql5? I don't know how the heck I got it to work the first time...

TIA

A: 

Not sure if your example was a typo or not, but for starters you need to have a space in between your flags and their values, roughly like this:

mysql -u root -p [password] db < db.sql
jaywon
I've tried it both ways. I still just get a long listing of all the commands.
A: 

Try this instead:

mysql -u root -p
(prompts for password)
use db;
source db.sql
wallyk
You're my hero. Worked perfectly.