如何设置全局event_scheduler=ON,即使MySQL重新启动?

时间:2022-09-23 02:16:49

I want to set the event_scheduler global to ON even if MySQL is restarted; how can I achieve this?

我想将event_scheduler全局设置为ON,即使MySQL重新启动;我怎样才能做到这一点呢?

SET GLOBAL event_scheduler = ON;

6 个解决方案

#1


1  

One Way - You can set your system variables and use those variables if there is any possibility to restart your mysql.

一种方法是,你可以设置你的系统变量,如果有可能重启你的mysql,你可以使用这些变量。

Here is link Using system variables in mysql

这里是mysql中使用系统变量的链接。

#2


22  

You can set

你可以设置

event_scheduler=ON

in my.ini or my.cnf file, then restart your server for the setting to take effect.

在我的。ini或my.cnf文件,然后重新启动服务器以使设置生效。

Once set event_scheduler will always remain ON no matter whether your server restarts.

一旦设置了event_scheduler,无论您的服务器是否重新启动,都将始终保持不变。

#3


19  

Open your /etc/mysql/my.ini file and add:

打开你的/etc/mysql/my.ini文件,并添加:

event_scheduler = on

under the [mysqld] section

下(mysqld)部分

(tested under mysql 5.5.35-0+wheezy1 - Debian)

(在mysql 5.5.35-0+wheezy1 - Debian下进行测试)

#4


1  

On our Windows Server 2012 system, none of these or any other solutions worked. Then I looked at the registry entry for start up:

在我们的Windows Server 2012系统上,这些或任何其他解决方案都不起作用。然后我看了一下注册表的开始:

"C:\Program Files\MySQL\MySQL Server 5.6\bin\mysqld.exe" --defaults-file="C:\ProgramData\MySQL\MySQL Server 5.6\my.ini" MySQL56

“C:\ Program Files \ MySQL \ 5.6 \ bin \ mysqld MySQL服务器。exe”——defaults-file = " C:\ ProgramData \ MySQL \ 5.6 \我的MySQL服务器。ini”MySQL56

The trick, the evil, is ProgramData. It's not Program Files. Look in Program Files and you'll see a my-default.ini file, put there just to royally screw you up.

邪恶的把戏就是程序数据。这不是程序文件。看看程序文件,你会看到一个默认的。ini文件,放在那里只是为了让你更上一层。

The trick is to find the path in the registry, which was for me: HKEY_LOCAL_MACHINE\SYSTEM\Services\MySQL56

诀窍是找到注册表中的路径,这是给我的:HKEY_LOCAL_MACHINE\SYSTEM\Services\MySQL56。

#5


0  

sudo nano /etc/mysql/mysql.conf.d/mysqld.cnf 

Add this line at the end of the file:

在文件末尾添加这一行:

event_scheduler=ON

Than reboot and check if daemon is started after reboot:

在重新启动后,要重新启动并检查守护进程是否启动:

Log into mysql bash:

登录到mysql bash:

mysql -u <user> -p

Than run the command:

运行以下命令:

SHOW PROCESSLIST;

Now you should see the event scheduler daemon in the list

现在您应该在列表中看到事件调度器守护进程。

#6


-4  

Also you can use

你也可以使用

SET GLOBAL event_scheduler = 1;

Then restart your server for the setting to take effect.

然后重启服务器,让设置生效。

#1


1  

One Way - You can set your system variables and use those variables if there is any possibility to restart your mysql.

一种方法是,你可以设置你的系统变量,如果有可能重启你的mysql,你可以使用这些变量。

Here is link Using system variables in mysql

这里是mysql中使用系统变量的链接。

#2


22  

You can set

你可以设置

event_scheduler=ON

in my.ini or my.cnf file, then restart your server for the setting to take effect.

在我的。ini或my.cnf文件,然后重新启动服务器以使设置生效。

Once set event_scheduler will always remain ON no matter whether your server restarts.

一旦设置了event_scheduler,无论您的服务器是否重新启动,都将始终保持不变。

#3


19  

Open your /etc/mysql/my.ini file and add:

打开你的/etc/mysql/my.ini文件,并添加:

event_scheduler = on

under the [mysqld] section

下(mysqld)部分

(tested under mysql 5.5.35-0+wheezy1 - Debian)

(在mysql 5.5.35-0+wheezy1 - Debian下进行测试)

#4


1  

On our Windows Server 2012 system, none of these or any other solutions worked. Then I looked at the registry entry for start up:

在我们的Windows Server 2012系统上,这些或任何其他解决方案都不起作用。然后我看了一下注册表的开始:

"C:\Program Files\MySQL\MySQL Server 5.6\bin\mysqld.exe" --defaults-file="C:\ProgramData\MySQL\MySQL Server 5.6\my.ini" MySQL56

“C:\ Program Files \ MySQL \ 5.6 \ bin \ mysqld MySQL服务器。exe”——defaults-file = " C:\ ProgramData \ MySQL \ 5.6 \我的MySQL服务器。ini”MySQL56

The trick, the evil, is ProgramData. It's not Program Files. Look in Program Files and you'll see a my-default.ini file, put there just to royally screw you up.

邪恶的把戏就是程序数据。这不是程序文件。看看程序文件,你会看到一个默认的。ini文件,放在那里只是为了让你更上一层。

The trick is to find the path in the registry, which was for me: HKEY_LOCAL_MACHINE\SYSTEM\Services\MySQL56

诀窍是找到注册表中的路径,这是给我的:HKEY_LOCAL_MACHINE\SYSTEM\Services\MySQL56。

#5


0  

sudo nano /etc/mysql/mysql.conf.d/mysqld.cnf 

Add this line at the end of the file:

在文件末尾添加这一行:

event_scheduler=ON

Than reboot and check if daemon is started after reboot:

在重新启动后,要重新启动并检查守护进程是否启动:

Log into mysql bash:

登录到mysql bash:

mysql -u <user> -p

Than run the command:

运行以下命令:

SHOW PROCESSLIST;

Now you should see the event scheduler daemon in the list

现在您应该在列表中看到事件调度器守护进程。

#6


-4  

Also you can use

你也可以使用

SET GLOBAL event_scheduler = 1;

Then restart your server for the setting to take effect.

然后重启服务器,让设置生效。