Jump to content

Recommended Posts

Posted

I need to enable the 'Event Scheduler Status' but when I try it says that

I don't have Permissions even tho I already enabled everything on:

 

MySQL® Databases -> User -> All Privileges -> make changes.

 

How Could I enable SUPER privilege to mySQL user? Thanks!

Posted

What is your cPanel username and the server your account is on? Also, what is the MySQL username you are trying to use?

Posted

I am not sure about that, I am handdling accounts from my Unity3D project with php+mySQL .Everyone that register should have 15 free days to use the software.So when someone register a value on the database shoud be set to 1 and after 15 days the value should be 0, for example.
Other option would be buying the software for 30 days, for example , so I would need to increase the "event time"...

Posted

So the first time a particular client/account connects the database stores the start timestamp, and then each time they connect it checks the difference between now() and the registration date to see if it exceeds their license period? Does the on or off bit need to update once a day or more often?

Posted
Well for a single event , the value in the database should be updated at maximum 2 times per day, I could be wrong, if the licence expires and if someone buy the licence.

But if we are thinking about that every account should have this event so it could happen a lot of times per day depending on the ammount of accounts. But I really don't expect a lot of accounts.

Posted

Well, you could have the license check occur each time the unity client connects to the database. That would probably be the best solution because then you wouldn't have to worry about someone buying your software and then not being able to use it until the scheduled event fires off 12 hours later.

Posted

Will you enable the Super Privilege for mysql user? I have to be able to create events with php to mySQL database and I really need that to continue my work.

Posted

You can use a cron job to do what you're trying to do. I'm trying to help you set it up by figuring out what you're trying to do.

 

The SUPER privilege enables an account to use CHANGE MASTER TO, KILL or mysqladmin kill to kill threads belonging to other accounts (you can always kill your own threads), PURGE BINARY LOGS, configuration changes using SET GLOBAL to modify global system variables, the mysqladmin debug command, enabling or disabling logging, performing updates even if the read_only system variable is enabled, starting and stopping replication on slave servers, specification of any account in the DEFINER attribute of stored programs and views, and enables you to connect (once) even if the connection limit controlled by the max_connections system variable is reached.

https://dev.mysql.com/doc/refman/5.7/en/privileges-provided.html#priv_super

 

You're not allowed to kill other users processes on a shared host. You're not allowed to purge our logs on a shared host. You're not allowed to change other people's global system variables. You're definitely not allowed to stop the mysql server. Etc., etc., etc.

 

The good news is it sounds like you definitely don't need super privilege to do what you're wanting to do.

Posted

I really don't wanna any of that but I would like to use Events, can't you guys create some new "user" that would be able to do so in the future?
Or am I the only one that is looking for this?

Anyway, I didn't know cron job exists, but it seens like it will do the job. Do you have any good guides to learn how to do it? Would I be able to change the date after the cron job already started?

I am reading a post from 2011 that said that I could only run 2 jobs per day, is this still in practise? If I have to change the database for 5 accounts in a day would this still be possible?

Edit-------------

 

I found some libraries that could be useful:

 

https://github.com/jobbyphp/jobby

https://github.com/MUlt1mate/cron-manager

https://github.com/MediovskiTechnology/php-crontab-manager

 

Cron Manager from MUlt1mate seens to be the best for me since It generates an ID for each task, I could use the ID and set a value for each user on the respective database, so when I need to update the task I would search for that ID.

I didn't find a "constructor" on their git yet, i am looking for it now...

 

-------------

 

Thanks very much.

Posted

I am reading a post from 2011 that said that I could only run 2 jobs per day, is this still in practise? If I have to change the database for 5 accounts in a day would this still be possible?

Yeah, but we can set up a remote cron job for you that can fire as often as every 5 minutes. You just need to set up a script like mydomain.com/cron/process_db.php and the remote cron will run the script every 5 minutes or however often you want.

 

Here's some psuedocode to give you an idea:

<?php

// load up database details and password
require_once(config.php);

// create a database connection
$con = new mysqli($db_host, $db_user, $db_pass, $db_data);

// query for ids of accounts that are expired
$sql = "select id from accounts where accounts.type = 'FREE' and accounts.reg_date < (date_sub(curdate(), interval 15 day))";

// execute the query
$result = $con->query($sql);

// store results in array
$ids = mysqli_fetch_array($result);

// cycle through each account
foreach ($ids as $id) {

  // query to update
  $sql = "update accounts set accounts.enabled = '0' where accounts.id = '$id'";

  // execute the query
  $con->query($sql);

}
Posted

wow I didn't thought that it could be done this way, I would create a cron job for every account but this way I could run just one cron Job.
Do you think that running this every 1 hour is to "heavy"? Thanks agin!

Posted

You can only run it twice a day if you use the cron page in cpanel, but if you let us know the url of the script we can set up a cron to execute it once an hour.

Posted

You can only run it twice a day if you use the cron page in cpanel, but if you let us know the url of the script we can set up a cron to execute it once an hour.

Ok thanks, i will do that when I finish the script. Could you change the timezone from mySQL?

Something like this: SET GLOBAL time_zone = 'America/Sao_Paulo';

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...