This is a read-only copy of the MariaDB Knowledgebase generated on 2024-11-17. For the latest, interactive version please visit https://mariadb.com/kb/.

Cannot create user account

Server version: 10.0.23-MariaDB Fedora 23 64 bit

I am logged in as root.

MariaDB [(none)]> create user brown@localhost ;
ERROR 1396 (HY000): Operation CREATE USER failed for 'brown'@'localhost'

Syntax is correct, yet, as can be seen, it fails. What am I doing wrong?

Answer Answered by Daniel Bartholomew in this comment.

That query should work if you're logged in as the MariaDB root user.

To debug I would first check to make sure you are logged in as root with:

SELECT USER(),CURRENT_USER();

The output should be something like the following:

MariaDB [(none)]> SELECT USER(),CURRENT_USER();
+----------------+----------------+
| USER()         | CURRENT_USER() |
+----------------+----------------+
| root@localhost | root@localhost |
+----------------+----------------+
1 row in set (0.01 sec)

MariaDB [(none)]>

Then issue a SHOW GRANTS to check what your logged-in user's permissions are.

The root user should have permissions similar to the following:

MariaDB [(none)]> SHOW GRANTS;
+---------------------------------------------------------------------+
| Grants for root@localhost                                           |
+---------------------------------------------------------------------+
| GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' WITH GRANT OPTION |
| GRANT PROXY ON ''@'%' TO 'root'@'localhost' WITH GRANT OPTION       |
+---------------------------------------------------------------------+
2 rows in set (0.00 sec)

MariaDB [(none)]>
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.