

CREATE TRIGGER logCreator AFTER INSERT ON MainTable Let us first create a table mysql> create table DemoTable -> ( -> UserMessage text, -> UserMessageSentDate date -> ) Query OK, 0 rows affected (0. less than operator to get all the records before the current date. What Is phpMyAdmin phpMyAdmin is a free and open-source database management tool. MySQL MySQLi Database To delete all rows older than 30 days, you need to use the DELETE with INTERVAL.

Phpmyadmin delete database entry how to#
phpMyAdmin allows you to manage your MySQL and MariaDB databases even without knowing how to write SQL or use the command prompt. If there is no column with timestamp of a row creation in your table, then you can create trigger that will insert current timestamp and inserted row identificator to auxiliary table. If you're not familiar with SQL and the command line, then the phpMyAdmin tool is for you. WHERE `timestamp_column` < CURRENT_TIMESTAMP - INTERVAL 6 MONTH For example CREATE EVENT cleaning ON SCHEDULE EVERY 1 MONTH ENABLE

To enable it use SET GLOBAL event_scheduler = ON Īfter that you could crate event that will check rows creation time and delete old records. There is detailed example in my post on the Stack Overflow, you just need to change time interval value from 24 hours to 6 months.įirstly, make sure the Event Scheduler is enabled. The Event Scheduler allows to execute regular events according to a schedule.
