MySQL 如何在mysql中永久激活/设置全局event_scheduler为1
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/3797830/
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
how to permanently activate/set the global event_scheduler to 1 in mysql
提问by Charanraj Golla
I have added a event to my mySQL db and it works fine, but the thing that is bothering me is that every now and then I have to set the mysql global variable to 1 so that my event is active.I log in as root user and have complete privileges (I use it for practice purpose)
我在 mySQL 数据库中添加了一个事件并且它工作正常,但困扰我的是我必须时不时地将 mysql 全局变量设置为 1,以便我的事件处于活动状态。我以 root 用户身份登录并拥有完整的权限(我将其用于练习目的)
Every time I log in to my mysql server I have to execute the following line
每次登录到我的 mysql 服务器时,我都必须执行以下行
__set global event_scheduler=1__
can I set the event_scheduler variable permanently to 1? I'm using mysql 5.1.50 - community
我可以将 event_scheduler 变量永久设置为 1 吗?我正在使用 mysql 5.1.50 - 社区
回答by nos
Yes, write event_scheduler=on
somewhere under the [mysqld]
section in the default mysql config file, usually /etc/my.cnf
是的,写在默认mysql配置文件中event_scheduler=on
的[mysqld]
部分下,通常/etc/my.cnf
回答by Athar
If you are using WAMP :
如果您使用的是 WAMP :
Open its control panel by clicking on the WAMP icon -> mysql-> my.ini
单击 WAMP 图标 -> mysql-> 打开其控制面板 my.ini
Its location may be at:
它的位置可能在:
C:\wamp\bin\mysql\mysql{your.ver.sion}
Add EVENT_SCHEDULER=ON
under [mysqld]- not [mysql]notice the "d" for daemon. Another tip to ascertain where you're adding is where your (default) server port is specified.
EVENT_SCHEDULER=ON
在[mysqld]下添加- 不是[mysql]注意守护进程的“d”。确定添加位置的另一个提示是指定(默认)服务器端口的位置。
[mysqld]
port=3306
event_scheduler=on