What if root can’t CREATE or DROP a user?

The following situation is a bit confusing:

MariaDB [(none)]> CREATE USER 'obj_stk_sequence'@'localhost';
ERROR 1396 (HY000): Operation CREATE USER failed for 'obj_stk_sequence'@'localhost'
MariaDB [(none)]> drop user obj_stk_sequence;
ERROR 1396 (HY000): Operation DROP USER failed for 'obj_stk_sequence'@'%'
MariaDB [(none)]> select current_user;
+----------------+
| current_user   |
+----------------+
| root@localhost |
+----------------+
1 row in set (0.00 sec)

Sure, if the user already exists you are unable to CREATE him, even if you’re root. And if he doesn’t exists, you can’t DROP him. But, WTF, it’s impossible that he EXISTS and NOT EXISTS at the same time!

Uhm. Maybe it’s possible… if some system tables are damaged. In fact, I’ve CHECKed all tables in `mysql` and retried, and everything was ok:

MariaDB [(none)]> create user obj_stk_sequence;
Query OK, 0 rows affected (0.00 sec)
 
MariaDB [(none)]> drop user obj_stk_sequence;
Query OK, 0 rows affected (0.00 sec)

I’ve noticed that if the `mysql`.`proc` system table is corrupted, a clear error informs you about the problem. However, if you can’t CREATE and DROP Continue reading