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

How to move existing MySQL events to another database?

王林
Release: 2023-09-07 22:45:03
forward
1292 people have browsed it

如何将现有的 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)
Copy after login

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'
Copy after login

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!

source:tutorialspoint.com
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template