Grant all privileges nightmare on MariaDB street

MySQL

Getting the error below?

> GRANT ALL PRIVILEGES ON whmcs.* TO 'whmcs'@'localhost';
ERROR 1044 (42000): Access denied for user 'root'@'localhost' to database 'whmcs'

Or this?

mysql> GRANT ALL PRIVILEGES ON whmcs.* TO 'whmcs'@'localhost';
ERROR 1410 (42000): You are not allowed to create a user with GRANT

These errors now are bestowed the official worst problem you can get with MariaDB / MySQL that even AI struggles to fix.

Log in as root then run this sequence to see why you're having a hard time:

mysql> SELECT PLUGIN_NAME, PLUGIN_STATUS FROM INFORMATION_SCHEMA.PLUGINS WHERE PLUGIN_TYPE='AUTHENTICATION';
+-----------------------+---------------+
| PLUGIN_NAME           | PLUGIN_STATUS |
+-----------------------+---------------+
| sha256_password       | ACTIVE        |
| caching_sha2_password | ACTIVE        |
+-----------------------+---------------+

MariaDB [(none)]> select current_user(); +----------------+ | current_user() | +----------------+ | root@localhost | +----------------+ 1 row in set (0.000 sec) MariaDB [(none)]> SHOW GRANTS FOR 'root'@'localhost'; +---------------------------------------------------+ | Grants for root@localhost | +---------------------------------------------------+ | GRANT ALL PRIVILEGES ON *.* TO `root`@`localhost` | +---------------------------------------------------+ 1 row in set (0.000 sec) MariaDB [(none)]> SELECT Host, User, Grant_priv, Super_priv FROM mysql.user WHERE User = 'root'; +-----------+------+------------+------------+ | Host | User | Grant_priv | Super_priv | +-----------+------+------------+------------+ | localhost | root | N | Y | +-----------+------+------------+------------+ 1 row in set (0.002 sec) mysql> DROP USER IF EXISTS 'whmcs'@'localhost'; Query OK, 0 rows affected, 1 warning (0.01 sec) mysql> mysql> CREATE USER 'whmcs'@'localhost' IDENTIFIED WITH caching_sha2_password BY 'password'; Query OK, 0 rows affected (0.01 sec) mysql> GRANT ALL PRIVILEGES ON whmcs.* TO 'whmcs'@'localhost'; Query OK, 0 rows affected (0.00 sec) mysql> FLUSH PRIVILEGES; Query OK, 0 rows affected (0.01 sec)