Import MySQL Schema into my database


#1

I have been trying to import a schema into my database through the Shell and using the following syntax:

mysql -h mydatabasehost -u user -p passwd database < schema

All I get is a list of options and nothing happens to the database.

Any suggestions would be greatly appriciated.


#2

mysql -h mydatabasehost -u user -p database < schema

Try that (removed the passwd bit). I think if you are going to enter your password that way, then it needs to be right next to the -p switch

mysql -h mydatabasehost -u user -ppasswd database < schema

http://dev.mysql.com/doc/mysql/en/mysql.html

Also, if your SQL file has a USE command in it, you don’t need to specify the database. Maybe use schema.sql?


#3

Thanks! The first line worked great! Next time I do it I will try the second line to see what happens.


#4

You are correct. There should not be “passwd” after “-p”. As in another post, if the is removed, it might work.