1

I am not sure how to word this but here is my question:

is there a way to have mysql update records at certain times automatically within phpmyadmin?

micker
  • 135
  • 2
  • 13
  • Use the MySQL event scheduler to do the update. –  Oct 26 '13 at 11:15
  • Your problem can be solve by cron job. See this link: [http://stackoverflow.com/questions/14805742/cronjob-or-mysql-event][1] [1]: http://stackoverflow.com/questions/14805742/cronjob-or-mysql-event – Vijay Verma Oct 26 '13 at 11:17

2 Answers2

4

Mysql Event Scheduler is very good option, if you want to do all in mysql using sql.

there is a good tutorial on site point for this. http://www.sitepoint.com/how-to-create-mysql-events/

if you want to insert some data or update some data or delete some data and on other case also on particular time stamp on a schedule basis.you can easily use this.

developerCK
  • 4,418
  • 3
  • 16
  • 35
  • Wow! Thanks for the help everyone! The sitepoint link is especially helpful. – micker Oct 26 '13 at 11:24
  • I have another question, if anyone could answer it. Using the tuitorial from the sitepoint link that developerCK said, where do I plop this? I tried in the appropriate databases SQL area, but no process becomes set up. DELIMITER $$ CREATE EVENT `dude` ON SCHEDULE EVERY 1 HOUR STARTS '2013-10-26 04:37:00' DO BEGIN UPDATE whoa SET blah=1; END; DELIMITER ; – micker Oct 26 '13 at 11:51
  • check that if you have on your event scheduler variable. it is in article. – developerCK Oct 26 '13 at 12:01
3

PHPMyAdmin just client for MySQL. But you could use many solutions of it.

Example for cron

0 */2 * * *  mysql -h localhost -u user -ppassword -P 3306 < UPDATE `table` SET `field`='value' WHERE `id`=100500 ;

Example

SET GLOBAL event_scheduler = 1;
CREATE EVENT newEvent
ON SCHEDULE EVERY 2 HOUR
DO
UPDATE `table` SET `field`='value' WHERE `id`=100500 ;
sectus
  • 15,605
  • 5
  • 55
  • 97
  • Never heard about the MySQL scheduler... Thanks! :) – hek2mgl Oct 26 '13 at 11:18
  • Hmmm... I am clearly doing something wrong, because when I do this one it says there is syntax error: SET GLOBAL event_scheduler = 1 CREATE EVENT myeventname ON SCHEDULE EVERY 1 HOUR DO UPDATE yatta` SET `blah`='1'; I even added the delimeter and end. it executed, but no process is added: DELIMITER $$ SET GLOBAL event_scheduler = 1 CREATE EVENT chibi_shops ON SCHEDULE EVERY 1 HOUR DO UPDATE `shops ` SET `shopStockCurrent`='shopStockMax'; END; DELIMITER ; – micker Oct 26 '13 at 12:03
  • @micker, add semicolon after first statement. – sectus Oct 26 '13 at 12:27