The Blog

Author: admin

Event scheduler in MySql

Posted on

Since Mysql version 5.1.6, the system supports the option to schedule the execution of some events, without need to use external software (cron, at, Task Scheduler, etc.)  or to change data as required for trigger implementation.

To activate the schedule function in MySql, you have simply to execute in a client the following command:

SET GLOBAL event_scheduler = 1;

Then you can verify the correct system working, by executing the following command:

SHOW PROCESSLIST;

A task can be executed once or more times and can be defined via a SQL syntax.

CREATE EVENT DELETE_BASKET_DATA
  ON SCHEDULE EVERY 1 MINUTE 
  DO DELETE FROM basket where created > DATE_SUB(NOW(), INTERVAL 30 MINUTE);

When a task is executed, all data older than 30 minutes will be deleted.

To show how many and which tasks have been defined on the database, you need to simply execute the command “SHOW EVENTS”.

To erase a task, you can simply execute the following command

DROP EVENT DELETE_BASKET_DATA;

By using this function, you can perform some maintenance tasks on data, without affecting other parts of your application. With such options, MySql was able to fill its gap with some of the most important relational databases currently available.

Posted in MySQL Leave a comment

Adding dbase.so to php7.x in PLESK

Posted on

First install DEV for the PHP you are using. In my case that would be PLESK PHP 7.1

apt-get install make gcc plesk-php71-dev

Next use PECL to install dbase extension.

/opt/plesk/php/7.1/bin/pecl install dbase-7.0.0beta1

If all goes good, you should see this:

Build process completed successfully
Installing '/opt/plesk/php/7.1/lib/php/modules/dbase.so'
install ok: channel://pecl.php.net/dbase-7.0.0beta1
configuration option "php_ini" is not set to php.ini location
You should add "extension=dbase.so" to php.ini

Last step is to register the extension:


echo "extension=dbase.so" > /opt/plesk/php/7.1/etc/php.d/dbase.ini

plesk bin php_handler --reread

Posted in PHP, PLESK 2 Comments
« Previous PageNext Page »