Skip navigation links

MySQL Forums :: Newbie :: How to connect to mysql and run sql commands in windows batch script?


Advanced Search

How to connect to mysql and run sql commands in windows batch script?
Posted by: Sachin G ()
Date: October 12, 2011 01:36PM

Hi All,

I am performance engineer and after every test i get some performance data and I store that data in csv file and then manually upload that data using LOAD DATA INFILE in MySQL database. This MySQL database is running on my test machine. I do this manually as of now. I would like to automate this.

I would like to write a simple windows batch file which will connect to MySQL database and the do bulk upload using LOAD DATA INFILE.

How do I connect to MySQL and run sql commands in windows batch script?

I tried to create the batch script as below.

echo Connect to mysql database on the machineName.domain.com
mysql -u root -p mypassword
connect perftest_results
select * from release_test_summary_results where Load_Test_Number = 760

But when i execute this batch script it asks me to enter the password and then throws the error

'connect' is not recognized as an internal or external command,
operable program or batch file.

'select' is not recognized as an internal or external command,
operable program or batch file.


Any pointers will be helpful. Thanks in advance.

Sachin

Options: ReplyQuote


Subject Written By Posted
How to connect to mysql and run sql commands in windows batch script? Sachin G 10/12/2011 01:36PM
Re: How to connect to mysql and run sql commands in windows batch script? Barry Galbraith 10/12/2011 12:59PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.