Uploaded image for project: 'MariaDB Server'
  1. MariaDB Server
  2. MDEV-20435

ALTER USER prints bad error message if specified user account does not exist

    XMLWordPrintable

    Details

      Description

      GRANT prints a very nice error message if the specified user account does not exist and sql_mode has NO_AUTO_CREATE_USER set. In contrast, ALTER USER prints a generic error message, so the root cause can be difficult to determine in some cases.

      GRANT:

      MariaDB [(none)]> CREATE USER IF NOT EXISTS 'testuser'@'127.0.0.1' IDENTIFIED BY 'Pa$swd123';
      Query OK, 0 rows affected (0.001 sec)
       
      MariaDB [(none)]> GRANT SELECT ON *.* TO 'testuserr'@'127.0.0.1';
      ERROR 1133 (28000): Can't find any matching row in the user table
      

      ALTER USER:

      MariaDB [(none)]> CREATE USER IF NOT EXISTS 'testuser'@'127.0.0.1' IDENTIFIED BY 'Pa$swd123';
      Query OK, 0 rows affected (0.001 sec)
       
      MariaDB [(none)]> ALTER USER 'testuserr'@'127.0.0.1' IDENTIFIED VIA ed25519 USING PASSWORD('Pa$swd123');
      ERROR 1396 (HY000): Operation ALTER USER failed for 'testuserr'@'127.0.0.1'
      

      I think that ALTER USER's error message should be similar to the one used by GRANT in this case.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              robertbindar Robert Bindar
              Reporter:
              GeoffMontee Geoff Montee
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

                Dates

                Created:
                Updated: