Uploaded image for project: 'Debezium'
  1. Debezium
  2. DBZ-2576

New MySQL 8 ALTER USER password options not supported

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major Major
    • 1.3.0.Final
    • None
    • mysql-connector
    • None

      Having a io.debezium.connector.mysql.MySqlConnector connector configured against a MySQL 8.0.15 database, executing the following SQL statement:

      ALTER USER 'user'@'%' IDENTIFIED WITH 'mysql_native_password' AS '*2470C0C06DEE42FD1618BB99005ADCA2EC9D1E19' REQUIRE NONE PASSWORD EXPIRE DEFAULT ACCOUNT UNLOCK PASSWORD HISTORY DEFAULT;
      

      makes the connector fail with the following exception:

      org.apache.kafka.connect.errors.ConnectException: no viable alternative at input 'ALTER USER 'user'@'%' IDENTIFIED WITH 'mysql_native_password' AS '*2470C0C06DEE42FD1618BB99005ADCA2EC9D1E19' REQUIRE NONE PASSWORD EXPIRE DEFAULT ACCOUNT UNLOCK PASSWORD HISTORY'
      	at io.debezium.connector.mysql.AbstractReader.wrap(AbstractReader.java:230)
      	at io.debezium.connector.mysql.AbstractReader.failed(AbstractReader.java:207)
      	at io.debezium.connector.mysql.BinlogReader.handleEvent(BinlogReader.java:600)
      	at com.github.shyiko.mysql.binlog.BinaryLogClient.notifyEventListeners(BinaryLogClient.java:1130)
      	at com.github.shyiko.mysql.binlog.BinaryLogClient.listenForEventPackets(BinaryLogClient.java:978)
      	at com.github.shyiko.mysql.binlog.BinaryLogClient.connect(BinaryLogClient.java:581)
      	at com.github.shyiko.mysql.binlog.BinaryLogClient$7.run(BinaryLogClient.java:860)
      	at java.lang.Thread.run(Thread.java:748)
      Caused by: io.debezium.text.ParsingException: no viable alternative at input 'ALTER USER 'user'@'%' IDENTIFIED WITH 'mysql_native_password' AS '*2470C0C06DEE42FD1618BB99005ADCA2EC9D1E19' REQUIRE NONE PASSWORD EXPIRE DEFAULT ACCOUNT UNLOCK PASSWORD HISTORY'
      	at io.debezium.antlr.ParsingErrorListener.syntaxError(ParsingErrorListener.java:40)
      	at org.antlr.v4.runtime.ProxyErrorListener.syntaxError(ProxyErrorListener.java:41)
      	at org.antlr.v4.runtime.Parser.notifyErrorListeners(Parser.java:544)
      	at org.antlr.v4.runtime.DefaultErrorStrategy.reportNoViableAlternative(DefaultErrorStrategy.java:310)
      	at org.antlr.v4.runtime.DefaultErrorStrategy.reportError(DefaultErrorStrategy.java:136)
      	at io.debezium.ddl.parser.mysql.generated.MySqlParser.sqlStatements(MySqlParser.java:1121)
      	at io.debezium.ddl.parser.mysql.generated.MySqlParser.root(MySqlParser.java:849)
      	at io.debezium.connector.mysql.antlr.MySqlAntlrDdlParser.parseTree(MySqlAntlrDdlParser.java:68)
      	at io.debezium.connector.mysql.antlr.MySqlAntlrDdlParser.parseTree(MySqlAntlrDdlParser.java:41)
      	at io.debezium.antlr.AntlrDdlParser.parse(AntlrDdlParser.java:80)
      	at io.debezium.connector.mysql.MySqlSchema.applyDdl(MySqlSchema.java:314)
      	at io.debezium.connector.mysql.BinlogReader.handleQueryEvent(BinlogReader.java:793)
      	at io.debezium.connector.mysql.BinlogReader.handleEvent(BinlogReader.java:583)
      	... 5 more
      Caused by: org.antlr.v4.runtime.NoViableAltException
      	at org.antlr.v4.runtime.atn.ParserATNSimulator.noViableAlt(ParserATNSimulator.java:2026)
      	at org.antlr.v4.runtime.atn.ParserATNSimulator.execATN(ParserATNSimulator.java:467)
      	at org.antlr.v4.runtime.atn.ParserATNSimulator.adaptivePredict(ParserATNSimulator.java:393)
      	at io.debezium.ddl.parser.mysql.generated.MySqlParser.sqlStatements(MySqlParser.java:923)
      	... 12 more
       

      I have taken a look at the documentation from MySQL, and there have been some changes in the ALTER USER statement regarding password options (e.g. the PASSWORD HISTORY one included in the SQL statement above):

      https://dev.mysql.com/doc/refman/5.7/en/alter-user.html

      password_option: {
          PASSWORD EXPIRE
        | PASSWORD EXPIRE DEFAULT
        | PASSWORD EXPIRE NEVER
        | PASSWORD EXPIRE INTERVAL N DAY
      }
      

      https://dev.mysql.com/doc/refman/8.0/en/alter-user.html

      password_option: {
          PASSWORD EXPIRE [DEFAULT | NEVER | INTERVAL N DAY]
        | PASSWORD HISTORY {DEFAULT | N}
        | PASSWORD REUSE INTERVAL {DEFAULT | N DAY}
        | PASSWORD REQUIRE CURRENT [DEFAULT | OPTIONAL]
        | FAILED_LOGIN_ATTEMPTS N
        | PASSWORD_LOCK_TIME {N | UNBOUNDED}
      } 
      

      and this new specification is not included in the MySqlParser grammar:

      https://github.com/debezium/debezium/blob/master/debezium-ddl-parser/src/main/antlr4/io/debezium/ddl/parser/mysql/generated/MySqlParser.g4#L1566-L1572

      userPasswordOption
          : PASSWORD EXPIRE
            (expireType=DEFAULT
            | expireType=NEVER
            | expireType=INTERVAL decimalLiteral DAY
            )?
          ;
      

       

              ccranfor@redhat.com Chris Cranford
              eeisman@gmail.com Eduardo Eisman (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated:
                Resolved: