在服务器重启时启用 mysql 事件调度程序

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/10071871/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-31 12:53:23  来源:igfitidea点击:

Enabling mysql Event scheduler on server restarts

mysqlphpmyadminscheduling

提问by dames

I am running phpmyadmin and installed apache server on my personal computer. My problem is that I am trying to set MySQL event_schedulerto always be enabled even when the server restarts. I was reading that by setting the following command line in the server configuration file (my.cnfor my.ini) it should work: event_scheduler=DISABLED. However, where do I locate this my.cnfor my.inifile, and also should the command line be event_scheduler=DISABLEDor event_scheduler=ENABLEDseeing that I want it to always be enabled?

我正在运行 phpmyadmin 并在我的个人计算机上安装了 apache 服务器。我的问题是我试图将 MySQL 设置event_scheduler为即使服务器重新启动也始终启用。我是通过在服务器配置文件(my.cnfmy.ini)中设置以下命令行来阅读它的,它应该可以工作:event_scheduler=DISABLED. 但是,我在哪里可以找到此文件my.cnfmy.ini文件,还应该使用命令行event_scheduler=DISABLED还是event_scheduler=ENABLED查看我希望始终启用它?

回答by Devart

You should set 'ON' value (not ENABLED).

您应该设置“ON”值(未启用)。

In the configuration file in [mysqld] section specify 'event-scheduler' option (not event_scheduler).

在 [mysqld] 部分的配置文件中指定“event-scheduler”选项(不是 event_scheduler)。

Also, you can start your MySQL server with '--event-scheduler' option, e.g. -

此外,您可以使用“--event-scheduler”选项启动您的 MySQL 服务器,例如 -

shell> mysqld --event-scheduler=ON

shell> mysqld --event-scheduler=ON

More information - event_scheduler system variable.

更多信息 - event_scheduler 系统变量

回答by netkiller

Add to my.cnf file to [mysqld] section.

将 my.cnf 文件添加到 [mysqld] 部分。

GLOBAL event_scheduler=ON

Restart your mysql server. Check status with this command :

重新启动您的 mysql 服务器。使用此命令检查状态:

mysql> select @@GLOBAL.event_scheduler;
+--------------------------+
| @@GLOBAL.event_scheduler |
+--------------------------+
| ON                       |
+--------------------------+
1 row in set (0.00 sec)

mysql> SHOW VARIABLES LIKE 'event_scheduler';
+-----------------+-------+
| Variable_name   | Value |
+-----------------+-------+
| event_scheduler | ON    |
+-----------------+-------+
1 row in set (0.01 sec)

回答by Mohan Kumar

Here the path for my.inion XAMPP:

这是my.iniXAMPP 上的路径:

xampp\mysql\bin\my.ini

Open my.iniand add the following

打开my.ini并添加以下内容

[mysqld]
event_scheduler=ON

then restart MySQL service.

然后重启MySQL服务。

To check the status use the below MySQL query:

要检查状态,请使用以下 MySQL 查询:

SELECT @@event_scheduler

回答by AndrewD

For WAMP:

对于WAMP

  1. Edit your my.ini file and under the [mysqld] section, add this:

    event-scheduler=on

  2. restart all services

  3. verify by running this query:

    select @@event_scheduler;

  1. 编辑 my.ini 文件并在 [mysqld] 部分下添加以下内容:

    event-scheduler=on

  2. 重启所有服务

  3. 通过运行此查询进行验证:

    select @@event_scheduler;

To get to your my.ini file, just click the WAMP tray icon and hover over the 'MySQL' menu, and click 'my.ini'.

要访问 my.ini 文件,只需单击 WAMP 托盘图标并将鼠标悬停在“MySQL”菜单上,然后单击“my.ini”。

回答by Aurovrata

FOR MAMPon OS X:

FOR甲基苯丙胺在OS X:

the default installation does not include a my.cnffile so you need to create one and set up your default configuration. Therefore, to enable the the scheduler on an OS X MAMP stack, you need to,

默认安装不包含my.cnf文件,因此您需要创建一个文件并设置默认配置。因此,要在 OS X MAMP 堆栈上启用调度程序,您需要:

  1. stop your MySQL server
  2. create a my.cnffile in your /Applications/MAMP/conf/folder, you will need root access to do this (open a terminal window),

    sudo touch /Applications/MAMP/conf/my.cnf

    sudo nano /Applications/MAMP/conf/my.cnf

  3. the 2nd cmd will open the nano editor, paste the following in your file,

    [mysqld]

    event_scheduler=ON

  4. Save (^O) and exit (^X) the nano editor

  5. restart your MySQL server.

  1. 停止你的 MySQL 服务器
  2. my.cnf在您的/Applications/MAMP/conf/文件夹中创建一个文件,您需要 root 访问权限才能执行此操作(打开终端窗口),

    须藤触摸/Applications/MAMP/conf/my.cnf

    须藤纳米/Applications/MAMP/conf/my.cnf

  3. 第二个 cmd 将打开 nano 编辑器,将以下内容粘贴到您的文件中,

    [mysqld]

    event_scheduler=ON

  4. 保存 ( ^O) 并退出 ( ^X) nano 编辑器

  5. 重启你的 MySQL 服务器。