Using mySql on phpMyAdmin, I am trying to create a new users, and edit their permissions, firstly by granting access to everything, then removing only the specifics. When I try and do this, I always get an error message under 'Revoke'. I tried the auto create feature and then copied the sql this generated yet still an error under the 'Revoke'.
CREATE USER 'x'@'localhost' IDENTIFIED BY '123';
GRANT ALL ON *.* TO 'x'@'localhost';
REVOKE ALL PRIVILEGES ON *.* FROM 'x'@'localhost';
Error: 'Unrecognised statement type. (near REVOKE)'
Could anyone provide an answer to this? Thanks
To revoke all privileges, use the second syntax, which drops all global, database, table, column, and routine privileges for the named users or roles: REVOKE ALL PRIVILEGES, GRANT OPTION FROM user_or_role [, user_or_role] ... REVOKE ALL PRIVILEGES, GRANT OPTION does not revoke any roles.
The REVOKE statement enables system administrators to revoke privileges from MySQL accounts. For details on the levels at which privileges exist, the permissible priv_type , priv_level , and object_type values, and the syntax for specifying users and passwords, see Section 13.7.
MySQL doesn't implement the RESTRICT / CASCADE options in the REVOKE statement.
You can revoke the privileges from specific users or roles or from all users. Use the keyword PUBLIC to specify all users. The privileges revoked from PUBLIC and from individual users or roles are independent privileges.
CREATE USER 'x'@'localhost' IDENTIFIED BY '123';
GRANT ALL ON *.* TO 'x'@'localhost';
REVOKE DROP ON DB.* FROM x'@'localhost';
Should be correct since your revoke
statement was wrong
MySQL official link on REVOKE
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With