Uploaded image for project: 'Percona Server for MySQL'
  1. Percona Server for MySQL
  2. PS-8115

CREATE EVENT DEFINER=`[email protected]`@localhost processed as 'test'@'[email protected]'

Details

    • Bug
    • Status: Done
    • Medium
    • Resolution: Fixed
    • 5.7.36-39 (Q4 2021)
    • 5.7.37-40 (Q1 2022)
    • 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.
      
      

      Attachments

        Activity

          People

            luis.donoso Luis Donoso (Inactive)
            nickolay.ihalainen Nickolay Ihalainen
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Time Tracking

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - Not Specified
                Not Specified
                Logged:
                Time Spent - 2 days, 2 hours
                2d 2h

                Smart Checklist