Details
-
Bug
-
Status: Done
-
Medium
-
Resolution: Fixed
-
5.7.36-39 (Q4 2021)
-
None
-
None
Description
Event scheduler looks for the first @ sign to separate user name from host name.
MySQL can create users with @ side in the middle of user name:
create user `[email protected]`@localhost;
https://github.com/mysql/mysql-server/blob/mysql-5.7.37/sql/event_data_objects.cc#L449
ptr= strchr(definer.str, '@'); if (! ptr) ptr= definer.str; len= ptr - definer.str; definer_user.str= strmake_root(&mem_root, definer.str, len);
The event:
create database test; use test; CREATE DEFINER=`[email protected]`@`localhost` EVENT tevnt3 ON SCHEDULE AT CURRENT_TIMESTAMP + INTERVAL 1 MINUTE ON COMPLETION PRESERVE DO INSERT INTO test.tbl1 VALUES(103); SHOW CREATE EVENT tevnt3: Create Event: CREATE DEFINER=`test`@`[email protected]` EVENT `tevnt3` ON SCHEDULE AT '2022-03-15 02:28:48' ON COMPLETION PRESERVE ENABLE DO INSERT INTO test.tbl1 VALUES(103)
Error message:
2022-03-15T02:28:48.297637Z 1 [Note] Event Scheduler: Last execution of test.tevnt3. 2022-03-15T02:28:48.300370Z 11 [ERROR] Event Scheduler: [[email protected]@localhost].[test.tevnt3] execution failed, failed to authenticate the user. 2022-03-15T02:28:48.300427Z 11 [ERROR] Event Scheduler: [[email protected]@localhost][test.tevnt3] The user specified as a definer ('test'@'[email protected]') does not exist 2022-03-15T02:28:48.300448Z 11 [Note] Event Scheduler: [[email protected]@localhost].[test.tevnt3] event execution failed.