Questions tagged [mysql-event]

The MySQL Event Scheduler manages the scheduling and execution of events: Tasks that run according to schedule. Event support was added in MySQL 5.1.6.

The MySQL Event Scheduler manages the scheduling and execution of events: Tasks that run according to schedule. Event support was added in MySQL 5.1.6.

163 questions
2
votes
1 answer

Can a mysql transaction be done inside mysql event scheduler?

I want to update 3 tables based on the start date of another table. So i generate an event scheduler which checks the start date in that table and the current date.. It would be of great help to know if it is possible to create a transaction in an…
itsdevi
  • 21
  • 2
2
votes
1 answer

Schedule mysql event to run every chosen day of the week

i want to read my table logs after rotating my logs using an event and i want my event to run in any day of the week i choose. After doing some research,i have come up with this CREATE EVENT read_rotated_logs ON SCHEDULE EVERY 1 WEEK STARTS…
user3286430
2
votes
2 answers

how to create mysql table names based on the current month and year

I create mysql event script with the aim to create mysql tables automatically every month. I want the name of the tables based on the current month and year. How do I do that? I am trying this: CREATE DEFINER = `root`@`localhost` EVENT `event_name`…
new bie
  • 2,745
  • 6
  • 24
  • 26
2
votes
1 answer

How to update multiple records in mysql

I want to calculate interest over millions of record in mysql. So I am using scheduler create event cal_interest on every 1 day do update userTable set interest=(money*rate)/100 My question are: 1. Is it possible millions of record update…
Gabber
  • 7,169
  • 3
  • 32
  • 46
1
vote
0 answers

I am trying to drop procedure after 30 seconds but I got this error?

module.exports.mainStoredProcedure = async(allQuerys,message) => { const mainCallForSP = ` create procedure SP_${nanoId}() begin DECLARE errno varchar(300); DECLARE text varchar(300); DECLARE EXIT HANDLER FOR…
1
vote
1 answer

Problem with creating mysql event. Start transaction error

I what to create an event that delete rows fom a table that are older than 15 minus and add their value back to other table. In the code below mysql said that I have a syntax error on line 5 CREATE EVENT…
anzedolenc
  • 25
  • 4
1
vote
0 answers

mysql: taking many recurring averages with different intervals using events in

I have around 500 tables and each table is for a specific device. every table is getting full with data that comes every 3 minutes. Now I need to store averages of different timeframes of one same column(data) in tables . timeframes are 10 minutes,…
1
vote
1 answer

I want to use mysql event to update a column in events table with case statement in Mysql Workbench

CREATE EVENT update_status ON SCHEDULE EVERY 2 SECOND DO UPDATE `practiceme.events` as e set `e.status` = CASE WHEN CURRENT_DATE < `e.eventStart` THEN 'Upcoming' WHEN CURRENT_DATE > `e.eventStart` THEN 'Ongoing' …
jack
  • 87
  • 6
1
vote
0 answers

How to create mysql event which execute itself every last sunday of every last month in every quarter of the year on a specific time?

I'm trying to create mysql event which will execute itself every last sunday of the last month of every quarter in the year on a specific time, but i can't figure out how to create such schedule. Is there any options to set up schedule in such a…
1
vote
1 answer

MySQL select records missing occasionally when inserted by an EVENT

I am running event to fetch data from main table and inserting it into Summary table I am running MySQL event every 2 minute and calling stored procedure inside my event for some grouping, parsing and calculations from main table to summary…
prat
  • 81
  • 12
1
vote
1 answer

MySQL Deleting Row in an After Insert Trigger Error

I have three tables in a MySQL database, bids, offers and matched. The matched table contains bids and offers which have been matched. There is an event that runs the logic to do the matching shown below which works. CREATE EVENT…
WK123
  • 620
  • 7
  • 18
1
vote
1 answer

How to backup MySQL events with mysqldump?

I'm using the following mysqldump command to backup ma database: mysqldump --extended-insert=FALSE -hlocalhost -uusername -ppassword --databases my_database > ${FILELOCAL} This is working very well. I this database I also have some scheduled…
David
  • 2,898
  • 3
  • 21
  • 57
1
vote
0 answers

I want to add an attribute to an while condition on MySQL

i'm doing my first DB on mySQL and I want to make an underground like system. To start the system I want to make them go from one station to another on a fixed time of 2 seconds so I use the following code delimiter | CREATE EVENT runBlue ON…
Hugo Teles
  • 11
  • 1
1
vote
0 answers

Using results from select query as parameters for insert select query

I have a SELECT query which returns all matching rows added between 12 and 16 hours ago. It may return 0, 1, or multiple rows. SELECT service, service_host_name, time, reports_added FROM detections WHERE reports_added = 0 AND time…
turrican_34
  • 679
  • 1
  • 7
  • 27
1
vote
1 answer

Why is MySQL Event Scheduler Stuck Opening Tables?

I'm using MySQL 8.0.21 From the MySQL Community Installer on Windows 10 updated to version2004 and for some reason if I create a event in the event scheduler, which calls a procedure once every second (regardless of what that SP actually does, I'll…
DDeathlonger
  • 111
  • 2
  • 12
1 2
3
10 11