ALTEREVENTquery.hello_renamedRENAMEtotutorials.hello_renamed;QueryOK,0rowsaffected(0.00sec) To acknowledge the event has been moved to the database "tutorials", we can try"/> ALTEREVENTquery.hello_renamedRENAMEtotutorials.hello_renamed;QueryOK,0rowsaffected(0.00sec) To acknowledge the event has been moved to the database "tutorials", we can try">
This can also be accomplished with the help of the ALTER EVENT statement. We need to use a combination of database name and event name along with the RENAME keyword. To illustrate this, we use the following example where an event named "hello_renamed" is moved from the "query" database to the "tutorial" database -
mysql> ALTER EVENT query.hello_renamed RENAME to tutorials.hello_renamed; Query OK, 0 rows affected (0.00 sec)
To confirm that the event has been moved to the database "tutorials", we can try to delete the event with the old name, MySQL will throw an error like -
mysql> DROP event hello_renamed; ERROR 1539 (HY000): Unknown event 'hello_renamed'
The above is the detailed content of How to move existing MySQL events to another database?. For more information, please follow other related articles on the PHP Chinese website!