Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to solve the problem that the scheduled task of MySQL can not be executed normally?

2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/02 Report--

This article mainly explains the "MySQL timing tasks can not be carried out normally how to solve", the article explains the content is simple and clear, easy to learn and understand, the following please follow the editor's ideas slowly in-depth, together to study and learn "MySQL timing tasks can not be carried out normally how to solve" it!

Cause analysis and solution

When we find that the scheduled task of MySQL is not executed, we first go to the scheduled task to check whether the [last run] time is correct, and determine whether it is executed normally. If it is executed normally, we need to consider whether the event logic is incorrect.

If the last run time is empty or incorrect, you need to see if the database has a scheduled task open, and query by executing the following query statement

Show VARIABLES like'% event_schedule%'

If the result is ON, the database has scheduled tasks open, while for OFF, it is not open.

If the query result is OFF, there are two workarounds:

1. Set it directly in the database

SET GLOBAL event_scheduler = ON

This method can take effect immediately, but will fail after the database is restarted.

two。 Make changes in the database configuration file

Add the following code to the [mysqld] module of my.ini:

Event_scheduler=ON

This method needs to restart the database to take effect, and will not fail with the restart of the database.

After starting the scheduled task in the database, you also need to check whether your own scheduled task can be executed. Execute the following query statement in the database:

Show events

Check to see if the Status in the query result is correct, and the result is that ENABLE indicates that it has been started.

If the status is not ENABLE, we need to change it to ENABLE in the status bar of the scheduled task.

Let scheduled tasks be executed quickly

Some scheduled tasks are executed only once a day or more, and it will be troublesome if you want time to flow naturally to test. At this time, we need to modify the time of the database server according to the plan. In this way, you can quickly test whether the scheduled task can be executed properly.

Thank you for your reading, the above is the "MySQL timing tasks can not be properly carried out how to solve" the content, after the study of this article, I believe that you can not properly implement the MySQL timing tasks how to solve this problem have a deeper understanding, the specific use of the situation also needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report