0

I have this on my batch file:

drop database if exists inventory;
create database inventory;
use inventory;

mysql -u root -p inventory < C:\wamp\www\test\inventory.sql

And I already copied all the contents of

C:\wamp\bin\mysql\mysql5.1.36\bin

Into

C:\windows\system32

Just to make sure that it has the file that it needs to run. But when I executed the batch file. It just said that. create and use is not an operable command, it said it does not recognize the command. I also tried setting the path to

C:\wamp\bin\mysql\mysql5.1.36\bin

But still no luck. Please help

1
  • oops, did not see it's a half a year old question! How did it pop-up at top of the list? Commented Jan 27, 2011 at 12:42

2 Answers 2

1

You should add C:\wamp\bin\mysql\mysql5.1.36\bin to system path.

To add path do this. Go to My Computer > properties > Advanced System Settings > Advance > Environment Variable > select "Path" click edit add the C:\wamp\bin\mysql\mysql5.1.36\bin path at the end separated by ;

Edit your inventory.sql file at the top add

 drop database if exists inventory;
 create database inventory;
 use inventory;

write this (see below) in a batch file

 mysql -u root -pYOURPASSWORD < C:\wamp\www\test\inventory.sql

remember there is no space between -p and password.

Execute the batch file this should work.

Hope this helps

Sign up to request clarification or add additional context in comments.

Comments

0

try the use of create schema , seems more appropriate !? I was gonna comment instead of answer, but seems disabled !? Might be a syntaxt issue with wamp mysql 5.1.3 . . not sure, just a try

1 Comment

you require min 50 reps to be able to comment. I think this is pretty stupid restriction by SO. Reps to comment should be as low as 10.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.