I need events for MySQL database, But I realize that I can't have event for the host's level I bought. The only solution that I come up with is: 1- create a php page with a single button in it. 2- put the event codes into this page 3- put this page in a password protected folder 4- and every hour, open the page and hit the button. Not a good idea? I know. So, what is the best alternative?
Asked
Active
Viewed 1,199 times
1
-
Schedule the mysql event – Venkat.R Jan 02 '16 at 07:52
-
I asked hosting company for event: "I need Event for my databases but I can't enable it. please help me." and They told me: 'We do not offer this option. You can use regular cronjobs instead (Level 9 or higher).' My hosting plan is not Level 9 or higher. so I can't use corn job either. – cool Jan 02 '16 at 08:31
-
check my cron job answer – Venkat.R Jan 02 '16 at 08:32
-
Find a provider that isn't so limiting, or... use an external server or service like AWS Lambda (which now has cron capability) to hit your web site with a scheduled request sent to the special page that does the maintenance work. – Michael - sqlbot Jan 02 '16 at 16:55
2 Answers
1
As Jim in the comment. Try to use Cron Job and call your PHP Script for every hour is my alternative answer.
#!/usr/bin/env php
<?php
# This file would be say, '/usr/local/bin/run.php'
// code
echo "I'm CRON Script"
Add a Cron Job Command Structure:
Minutes [0-59]
| Hours [0-23]
| | Days [1-31]
| | | Months [1-12]
| | | | Days of the Week [Numeric, 0-6]
| | | | |
* * * * * home/path/to/command/the_command.sh
Command Example:
* 1 * * * php-path -f php-script-path &> /dev/null
* 1 * * * /usr/bin/php -f /usr/local/bin/run.php &> /dev/null
Add Permission through CHMOD command.
chmod +x /usr/local/bin/run.php
Reference:
How to create cron job using PHP?
http://code.tutsplus.com/tutorials/managing-cron-jobs-with-php--net-19428
0
Check the current process list by below command / enable event scheduler.
SHOW PROCESSLIST;
or
SET GLOBAL event_scheduler = ON;
Refer the Below URLs
https://dev.mysql.com/doc/refman/5.7/en/events-overview.html
http://www.sitepoint.com/how-to-create-mysql-events/
http://www.mysqltutorial.org/mysql-triggers/working-mysql-scheduled-event/

Venkat.R
- 7,420
- 5
- 42
- 63
-
1I run it in phpMyAdmin and the error is: Access denied; you need (at least one of) the SUPER privilege(s) for this operation. – cool Jan 02 '16 at 08:17
-
-
I ask them how can I turn it on, and they say: 'You need a higher level of hosting plan to have event_scheduler' – cool Jan 02 '16 at 08:23
-
@coolesterman So upgrade to that hosting plan. Or to another web host that doesn't impose this sort of arbitrary limitation. – Jan 02 '16 at 09:03
-
@duskwuff that would be costly. so there really is no way to solve this. I guess I should stick to my own outdated solution. :( – cool Jan 02 '16 at 09:23
-
-
As I said the hosting company told me, to use corn job, the hosting plane version 9 or higher is needed. I got version 4. – cool Jan 13 '16 at 13:59