![]() |
|
![]() | ||
|
Subject:
MYSQL From a Batch File
Category: Computers Asked by: alkeme-ga List Price: $20.50 |
Posted:
14 May 2004 11:00 PDT
Expires: 13 Jun 2004 11:00 PDT Question ID: 346411 |
I need to schedule a batch file to run a MYSQL script on a Windows 2000 server. I can perform the commands sucessfully from the command line, but not from the .bat file. From command line: line 1 -- cd Program Files\livestats\db\bin line 2 -- mysql -u <username> -p<password> database line 3 -- mysql> source filepath\mysql_script.sql line 4 -- mysql> quit When the Batch file (e.g. index.bat) is run, it always prompts after I've logged in. How can I execute MYSQL commands from the Batch file? Here is as far as I can go with the Batch file: line 1 -- C: line 2 -- cd Program Files\livestats\db\bin line 3 -- mysql -u <username> -p<password> database After this I just get a 'mysql>' prompt in the DOS window. It won't let me enter commands from the Batch file. How can I do this? |
![]() | ||
|
There is no answer at this time. |
![]() | ||
|
Subject:
Re: MYSQL From a Batch File
From: generica-ga on 14 May 2004 17:01 PDT |
Try one of the two lines in your batch file: mysql -u<username> -p<password> -e "source filepath\mysql_script.sql" database or type c:\filepath\mysql_script.sql | mysql -u<username> -p<password> database If neither works, I have some other options. |
Subject:
Re: MYSQL From a Batch File
From: gialam-ga on 15 May 2004 07:36 PDT |
Try this: line 1 -- C: line 2 -- cd "\Program Files\livestats\db\bin" line 3 -- mysql -u <username> -p<password> database < "source filepath\mysql_script.sql" |
Subject:
Re: MYSQL From a Batch File
From: simianadmin-ga on 18 Jun 2004 11:34 PDT |
We tried all comments and found this to work out for us. CLS C: cd\mysql\bin mysql -u <username> -p<password> < mysqlscript.sql Hosting the sql file in the bin directory eliminated a lot of hassel with the source file. The other thing that helped us out was having the use <database>; command in the sql script instead of the login. Hope this helps. |
If you feel that you have found inappropriate content, please let us know by emailing us at answers-support@google.com with the question ID listed above. Thank you. |
Search Google Answers for |
Google Home - Answers FAQ - Terms of Service - Privacy Policy |