Comments - CREATE USER

5 years, 7 months ago RL Potts

Thanks (not) for another poorly written, incomplete knowledge base article typical of Maria/MySQL.

don't forget to flush privileges if you create, delete then try to re-create a user:

MariaDB [mysql]> create user 'test'@'localhost'; Query OK, 0 rows affected (0.00 sec)

MariaDB [mysql]> delete from user where User='test'; Query OK, 1 row affected (0.00 sec)

MariaDB [mysql]> create user 'test'@'localhost'; ERROR 1396 (HY000): Operation CREATE USER failed for 'test'@'localhost' MariaDB [mysql]> flush privileges; Query OK, 0 rows affected (0.00 sec)

MariaDB [mysql]> create user 'test'@'localhost'; Query OK, 0 rows affected (0.00 sec)

Maybe there's a good reason for having to do this, but probably not ;)

 
5 years, 7 months ago Ian Gilfillan

If you access the privilege tables directly (as in your DELETE FROM statement), you need to flush the privileges. If you don't (as in your CREATE USER statements), you don't. Rather don't access the privilege tables directly, instead use DROP USER.

 
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.