diff --git a/mysql-test/r/skip_grants.result b/mysql-test/r/skip_grants.result index 58ced16acac12257cb51481ce3cbad5695028a90..9efeb56a8373250fce82084633b577cc38cb7bd2 100644 --- a/mysql-test/r/skip_grants.result +++ b/mysql-test/r/skip_grants.result @@ -58,3 +58,5 @@ DROP PROCEDURE p3; DROP FUNCTION f1; DROP FUNCTION f2; DROP FUNCTION f3; +set global event_scheduler=1; +ERROR HY000: The MySQL server is running with the --event-scheduler=DISABLED or --skip-grant-tables option so it cannot execute this statement diff --git a/mysql-test/t/skip_grants.test b/mysql-test/t/skip_grants.test index 6dda97fcf8a0a0bf6e8f75cce679f0ad24e2c3eb..c8ee3490552788668510c8fb92c86f5cd3cad64a 100644 --- a/mysql-test/t/skip_grants.test +++ b/mysql-test/t/skip_grants.test @@ -108,3 +108,10 @@ DROP PROCEDURE p3; DROP FUNCTION f1; DROP FUNCTION f2; DROP FUNCTION f3; + +# +# Bug #26807 "set global event_scheduler=1" and --skip-grant-tables crashes server +# +--error ER_OPTION_PREVENTS_STATEMENT +set global event_scheduler=1; + diff --git a/sql/mysqld.cc b/sql/mysqld.cc index d9fab73a23cead23ff10bd0a5d7d4ef8125d6d4e..560bd569c1468d4d473053346d317668e113f235 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -3691,6 +3691,7 @@ we force server id to 2, but this MySQL server will not act as a slave."); udf_init(); #endif } + init_status_vars(); if (opt_bootstrap) /* If running with bootstrap, do not start replication. */ opt_skip_slave_start= 1; @@ -3737,6 +3738,10 @@ we force server id to 2, but this MySQL server will not act as a slave."); if (Events::get_instance()->init()) unireg_abort(1); } + else + { + Events::opt_event_scheduler = Events::EVENTS_DISABLED; + } /* Signal threads waiting for server to be started */ pthread_mutex_lock(&LOCK_server_started); diff --git a/sql/set_var.cc b/sql/set_var.cc index 667abc0af181d9a4b5c99659d7a09d8623f5ef6f..a77698221eee7e755e4e03d47ae6d37d6e273e3d 100644 --- a/sql/set_var.cc +++ b/sql/set_var.cc @@ -3990,7 +3990,7 @@ sys_var_event_scheduler::update(THD *thd, set_var *var) DBUG_ENTER("sys_var_event_scheduler::update"); if (Events::opt_event_scheduler == Events::EVENTS_DISABLED) { - my_error(ER_OPTION_PREVENTS_STATEMENT, MYF(0), "--event-scheduler=DISABLED"); + my_error(ER_OPTION_PREVENTS_STATEMENT, MYF(0), "--event-scheduler=DISABLED or --skip-grant-tables"); DBUG_RETURN(TRUE); }