Skip to content

[P1][bug] Create User is a syntax error on MariaDB — the plugin clause it emits is MySQL-only #561

Closed

Description

@EVWorth

What

CreateUserDialog builds

CREATE USER 'name'@'%'
  IDENTIFIED WITH caching_sha2_password BY 'password'

MariaDB rejects that form outright, for both plugins the dialog offers:

MariaDB 11:  CREATE USER 'probe'@'%' IDENTIFIED WITH caching_sha2_password BY 'pw'
  -> ERROR 1064 (42000): ... syntax to use near 'BY 'pw''

MariaDB 11:  CREATE USER 'probe'@'%' IDENTIFIED WITH mysql_native_password BY 'pw'
  -> ERROR 1064 (42000): ... syntax to use near 'BY 'pw''

MariaDB 11:  CREATE USER 'probe'@'%' IDENTIFIED BY 'pw'
  -> ok

MySQL 8:     CREATE USER 'probe'@'%' IDENTIFIED WITH caching_sha2_password BY 'pw'
  -> ok

So creating a user against MariaDB fails every time, whichever plugin is chosen, and caching_sha2_password — the dialog's default — does not exist on MariaDB at all. MariaDB spells the plugin form IDENTIFIED VIA plugin USING ..., not IDENTIFIED WITH plugin BY ....

Files

Suggested fix

Branch on the server flavour, which the frontend already has: ConnectionInfo.server_version contains MariaDB, and explain.rs already branches on it for ANALYZE.

On MariaDB, emit plain IDENTIFIED BY '...' and either hide the plugin selector or offer MariaDB's own plugin names through IDENTIFIED VIA. caching_sha2_password should not be offered on a server that does not implement it.

Worth checking the neighbours at the same time: ALTER USER ... IDENTIFIED BY (ChangePasswordDialog) is portable and fine, but WITH MAX_USER_CONNECTIONS and ACCOUNT LOCK want the same treatment — MariaDB supports both, but only in positions worth confirming rather than assuming.

How this surfaced

Writing the integration coverage #445 asks for. The lifecycle test runs the statements the dialogs emit; the MySQL 8 run passes and the MariaDB form does not parse. Filed separately from #445 because that issue is about missing tests and this is a defect the tests found.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/adminkind/bugseverity/p1

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions