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">

Home  >  Article  >  Database  >  How to move existing MySQL events to another database?

How to move existing MySQL events to another database?

王林
王林forward
2023-09-07 22:45:031252browse

如何将现有的 MySQL 事件移动到另一个数据库?

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 -

Example

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!

Statement:
This article is reproduced at:tutorialspoint.com. If there is any infringement, please contact admin@php.cn delete