Jump to content

How To Enable Super Privilege (Mysql)


flpcarv

Recommended Posts

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!

Link to comment
Share on other sites

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"...

Link to comment
Share on other sites

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?

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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);

}
Link to comment
Share on other sites

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';

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...