title: How can I make MySQL automatically delete records of a table when date of deletion is specified in each record?
body: <p>I have made the following table in MySQL:</p>
  
  <pre><code>mysql&gt; use test;
  Database changed
  mysql&gt; desc NeoTec_test;
  +-------------+-------------+------+-----+---------+-------+
  | Field       | Type        | Null | Key | Default | Extra |
  +-------------+-------------+------+-----+---------+-------+
  | Product_Key | varchar(10) | NO   | PRI | NULL    |       |
  | Validation  | date        | YES  |     | NULL    |       |
  | Expiry      | date        | YES  |     | NULL    |       |
  +-------------+-------------+------+-----+---------+-------+
  3 rows in set (0.03 sec)
  
  mysql&gt; select * from NeoTec_test;
  +-------------+------------+------------+
  | Product_Key | Validation | Expiry     |
  +-------------+------------+------------+
  | GF427DHH5   | 2017-11-16 | 2017-11-17 |
  | GFHJV75HG   | 2017-11-16 | 2017-11-18 |
  | GFJYFRTV5   | 2017-11-16 | 2017-11-20 |
  +-------------+------------+------------+
  3 rows in set (0.00 sec)
  </code></pre>
  
  <p>Now coming to the point, I need some help with a part of my project. I want MySQL to automatically delete the Product keys that have expired, i.e., I want to get the product keys deleted automatically on their expiry dates given under the "Expiry" Column of the table. How can I do so? I am a total newbie to MySQL events so I would appreciate the full code... Thank you! :-)</p>
  
  <p>Earlier research I did was not fruitful, but I did found this, which was half helpful...:
  <a href="https://stackoverflow.com/questions/14096429/how-to-delete-a-mysql-record-after-a-certain-time">How to delete a MySQL record after a certain time</a></p>