JPC
JPC

Reputation: 5173

batch mysql script / schedule run the batch job

Is there a way to create a batch or a text file to execute .sql ?

Let say :

script location : C:\test.sql Hostname : host.name Port : 1000 user : me password : pw


test.sql -- >

select * from table1 ;quit;

How can I put all these into a .bat so that I can use the window to schedule the job to run in the future

Upvotes: 3

Views: 3869

Answers (1)

RolandoMySQLDBA
RolandoMySQLDBA

Reputation: 44343

Place this in a .bat called C:\RunSQL.bat

Make sure C:\RunSQL.bat looks like this:

@echo off
mysql -hhostname -P1000 -ume -ppw -AN < C:\test.sql

then just run it

RunSQL.bat

Give it a Try !!!

Upvotes: 2

Related Questions