riad
riad

Reputation: 7194

How to run a MYSQL query on a pre-defined fixed time?

I have a Mysql insert query. I need to run the query everyday, at 11:00 AM.

How do I execute a query on a fixed time in MySQL?
In MS-SQL i can easily do it by SQL Server agent job scheduler. So, is there any way to run a predefined schedule query in My-SQL? My MySQL version is: 5.5.12.

Upvotes: 3

Views: 7041

Answers (3)

Kevin Burton
Kevin Burton

Reputation: 11936

if you are using mysql 5.1.6 + use the event scheduler see: http://dev.mysql.com/doc/refman/5.1/en/events.html

or how about setting up a job in your OS using cron or at ?

Upvotes: 1

reggie
reggie

Reputation: 13711

You can use the event scheduler to achieve the above purpose in Mysql.

To create an event, you can use the create event statement. Here is an explanation with example.

Something like this:

CREATE EVENT e_totals
->     ON SCHEDULE AT '2006-02-10 23:59:00'
->     DO INSERT INTO test.totals VALUES (NOW());

Upvotes: 4

OMG Ponies
OMG Ponies

Reputation: 332521

Use the MySQL Event Scheduler

Upvotes: 3

Related Questions