diff --git a/parser/parser.y b/parser/parser.y index 73bc66d76c556..fca1d0fb1ae2b 100644 --- a/parser/parser.y +++ b/parser/parser.y @@ -6561,6 +6561,23 @@ AuthOption: ByAuthString: true, } } +| "IDENTIFIED" "WITH" StringName + { + $$ = nil + } +| "IDENTIFIED" "WITH" StringName "BY" AuthString + { + $$ = &ast.AuthOption { + AuthString: $5.(string), + ByAuthString: true, + } + } +| "IDENTIFIED" "WITH" StringName "AS" HashString + { + $$ = &ast.AuthOption{ + HashString: $5.(string), + } + } | "IDENTIFIED" "BY" "PASSWORD" HashString { $$ = &ast.AuthOption{ diff --git a/parser/parser_test.go b/parser/parser_test.go index b38e1e2de34b0..05f4934391dd2 100644 --- a/parser/parser_test.go +++ b/parser/parser_test.go @@ -1852,6 +1852,9 @@ func (s *testParserSuite) TestPrivilege(c *C) { {"CREATE USER 'uesr1'@'localhost'", true}, {"CREATE USER 'uesr1'@`localhost`", true}, {"CREATE USER `uesr1`@'localhost'", true}, + {"create user 'bug19354014user'@'%' identified WITH mysql_native_password", true}, + {"create user 'bug19354014user'@'%' identified WITH mysql_native_password by 'new-password'", true}, + {"create user 'bug19354014user'@'%' identified WITH mysql_native_password as 'hashstring'", true}, {`CREATE USER IF NOT EXISTS 'root'@'localhost' IDENTIFIED BY 'new-password'`, true}, {`CREATE USER 'root'@'localhost' IDENTIFIED BY 'new-password'`, true}, {`CREATE USER 'root'@'localhost' IDENTIFIED BY PASSWORD 'hashstring'`, true},