- Trending Categories
- Data Structure
- Operating System
- C Programming
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How to set global event_scheduler=ON even if MySQL is restarted?
152 Lectures 16 hours
87 Lectures 5.5 hours
There is a single way by which you can set a global event_scheduler=ON even if MySQL is restarted. You need to set global system variable ON and need to use this system variable even if MySQL restart.
For this, I am using system variable @@event_scheduler using select statement. The query is as follows:
mysql> select @@event_scheduler;
The following is the output:
+-------------------+ | @@event_scheduler | +-------------------+ | ON | +-------------------+ 1 row in set (0.00 sec)
Now, restart MySQL. The query is as follows:
mysql> restart; Query OK, 0 rows affected (0.00 sec)
After restarting the server the connection is lost for some time. If you use any query you will get the following error message:
mysql> select @@event_scheduler; ERROR 2013 (HY000): Lost connection to MySQL server during query
After some time if you will use the system variable @@event_scheduler again using select statement, then the output you will get the same i.e. ON. The query is as follows:
mysql> select @@event_scheduler; ERROR 2006 (HY000): MySQL server has gone away No connection. Trying to reconnect... Connection id: 8 Current database: *** NONE *** +-------------------+ | @@event_scheduler | +-------------------+ | ON | +-------------------+ 1 row in set (0.04 sec)
Or you can set the event_scheduler ON in my.cnf file or my.ini file. The statement is as follows:
[mysqld] event_scheduler = ON;
Now your event_scheduler is ON. Whether your server restarts or not, it will always be ON.
- How can we start MySQL event scheduler?
- Event scheduler in Python
- Select different fields in MySQL even if a field is set to null?
- Set special characters on values if condition is true in MySQL?
- How to check if event exists on element in jQuery?
- How to check if a timestamp is set in MySQL?
- How do I detect if the ON UPDATE event fired with query in MySQL?
- Why mean is NaN even if na.rm is set to TRUE using dplyr in R?
- How to set a global variable in Postman?
- How to disable some jQuery global Ajax event handlers for a request?
- What is MySQL event and how it is related to trigger?
- Scheduler activations
- How to Check if a Number is Odd or Even using Python?