[MDEV-25337] Confusing message with ALTER USER ... PASSWORD('newpass') command Created: 2021-04-03  Updated: 2021-04-05

Status: Open
Project: MariaDB Server
Component/s: None
Affects Version/s: 10.4, 10.5
Fix Version/s: 10.4, 10.5

Type: Bug Priority: Major
Reporter: Alexander Keremidarski Assignee: Unassigned
Resolution: Unresolved Votes: 0
Labels: None


 Description   

When trying to change the authentication plugin one can get an generic error which does not provide any useful information.

In this case the returned error is:

ERROR 1396 (HY000): Operation ALTER USER failed for 'root'@'localhost'

while it should be:

ERROR 1819 (HY000): Your password does not satisfy the current policy requirements


Example: With freshly installed 10.5 the root is identified via unix_socket

MariaDB [(none)]> SHOW GRANTS;
+------------------------------------------------------------------------------------------------+
| Grants for root@localhost                                                                      |
+------------------------------------------------------------------------------------------------+
| GRANT ALL PRIVILEGES ON *.* TO `root`@`localhost` IDENTIFIED VIA unix_socket WITH GRANT OPTION |
| GRANT PROXY ON ''@'%' TO 'root'@'localhost' WITH GRANT OPTION                                  |
+------------------------------------------------------------------------------------------------+

ALTER attempt results in:

MariaDB [(none)]> ALTER USER 'root'@'localhost' IDENTIFIED VIA mysql_native_password USING PASSWORD('password');
ERROR 1396 (HY000): Operation ALTER USER failed for 'root'@'localhost'

The error is not informative because the problem actually is with pasword not satisfying password check plugins so the following works:

MariaDB [(none)]> ALTER USER 'root'@'localhost' IDENTIFIED VIA mysql_native_password USING PASSWORD('1_Password_password');
Query OK, 0 rows affected (0.009 sec)
 
MariaDB [(none)]> SHOW GRANTS;
+----------------------------------------------------------------------------------------------------------------------------------------+
| Grants for root@localhost                                                                                                              |
+----------------------------------------------------------------------------------------------------------------------------------------+
| GRANT ALL PRIVILEGES ON *.* TO `root`@`localhost` IDENTIFIED BY PASSWORD '*B3D4E1ED7AF203404648B1010BBE3F5C41B8FC39' WITH GRANT OPTION |
| GRANT PROXY ON ''@'%' TO 'root'@'localhost' WITH GRANT OPTION                                                                          |
+----------------------------------------------------------------------------------------------------------------------------------------+
2 rows in set (0.000 sec)


Generated at Thu Feb 08 09:36:56 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.