How can we RENAME an existing MySQL event?

With the help of ALTER EVENT statement along with the RENAME keyword, we can RENAME an existing event. To illustrate it we are having the following example in which we are renaming the event ‘Hello’ to ‘Hello_renamed’ −


mysql> ALTER EVENT Hello RENAME TO Hello_renamed;
Query OK, 0 rows affected (0.00 sec)

To confirm that event has been renamed we can try to delete the event with the old name, MySQL will throw an error as follows −

mysql> DROP EVENT hello;
ERROR 1539 (HY000): Unknown event 'hello'

Updated on: 22-Jun-2020


Kickstart Your Career

Get certified by completing the course

Get Started