>데이터 베이스 >MySQL 튜토리얼 >mysql怎么设置job自动启动

mysql怎么设置job自动启动

WBOY
WBOY원래의
2016-06-07 16:27:32950검색

mysql如何设置job自动启动 1.检查当前的job mysql use dev; Reading table information for completion of table and column names You can turn off this feature to get a quicker startup with -A Database changed mysql show events; +-----+-----------

mysql如何设置job自动启动
1.检查当前的job
mysql> use dev;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A


Database changed
mysql> show events;
+-----+-------------+------------------+-----------+-----------+------------+----------------+----------------+---------------------+------+---------+------------+----------------------+----------------------+--------------------+
| Db  | Name        | Definer          | Time zone | Type      | Execute at | Interval value | Interval field | Starts              | Ends | Status  | Originator | character_set_client | collation_connection | Database Collation |
+-----+-------------+------------------+-----------+-----------+------------+----------------+----------------+---------------------+------+---------+------------+----------------------+----------------------+--------------------+
| dev | my_job_test | hxl@192.168.56.% | SYSTEM    | RECURRING | NULL       | 1              | DAY            | 2014-03-07 18:10:00 | NULL | ENABLED |          0 | utf8                 | utf8_general_ci      | latin1_swedish_ci  |
+-----+-------------+------------------+-----------+-----------+------------+----------------+----------------+---------------------+------+---------+------------+----------------------+----------------------+--------------------+
1 row in set (0.23 sec)


2.检查是否开启了自动启动
mysql> show global variables like '%event_scheduler%';
+-----------------+-------+
| Variable_name   | Value |
+-----------------+-------+
| event_scheduler | OFF   |
+-----------------+-------+
1 row in set (0.00 sec)


3.设置job自动启动
mysql> set global event_scheduler = on;
Query OK, 0 rows affected (0.00 sec)

4.设置mysql重启后,job能自动启动
编辑/etc/my.cnf文件,在[mysqld]下添加event_scheduler=1
[root@node1 etc]# more my.cnf
[mysqld]
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
user=mysql
# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0
event_scheduler=1


[mysqld_safe]
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid

-- The End --
성명:
본 글의 내용은 네티즌들의 자발적인 기여로 작성되었으며, 저작권은 원저작자에게 있습니다. 본 사이트는 이에 상응하는 법적 책임을 지지 않습니다. 표절이나 침해가 의심되는 콘텐츠를 발견한 경우 admin@php.cn으로 문의하세요.