You need replace only the last line:
CREATE USER 'AdminPS@localhost' IDENTIFIED BY PASSWORD '*CC3DA61A4716581A6A62EE83E5F4119D8C0B5D23';
GRANT ALL ON Database.* TO 'AdminPS@localhost';
GRANT CREATE USER ON *.* TO 'AdminPS@localhost';
Question
I need help with How create a new user with the possibilities to delete itself...
CREATE USER 'AdminPS'@'localhost' IDENTIFIED BY PASSWORD '*CC3DA61A4716581A6A62EE83E5F4119D8C0B5D23';
GRANT ALL ON Database.* TO 'AdminPS'@'localhost';
GRANT DROP USER 'AdminPS'@'localhost' TO 'AdminPS'@'localhost';
Solution
You need replace only the last line:
CREATE USER 'AdminPS@localhost' IDENTIFIED BY PASSWORD '*CC3DA61A4716581A6A62EE83E5F4119D8C0B5D23';
GRANT ALL ON Database.* TO 'AdminPS@localhost';
GRANT CREATE USER ON *.* TO 'AdminPS@localhost';
OTHER TIPS
As documented under GRANT
Syntax:
Table 13.1. Permissible Privileges for GRANT and REVOKE
+-----------------+-------------------------------------------+ | Privilege | Meaning | +-----------------+-------------------------------------------+ : : : | CREATE USER | Enable use of CREATE USER, DROP USER, | | | RENAME USER, and REVOKE ALL PRIVILEGES | : : : +-----------------+-------------------------------------------+ : : : | DROP | Enable databases, tables, and views to be | | | dropped | : : : +-----------------+-------------------------------------------+
Therefore, you need to grant the CREATE USER
privilege, not DROP
.
You need to create your user with WITH GRANT OPTION.
e.g.: GRANT ALL ON Database.* TO 'AdminPS'@'localhost' WITH GRANT OPTION;