Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

MySQL: Unrecognised statement type. (Near Revoke)

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

like image 583
10aples Avatar asked Jan 03 '18 20:01

10aples


People also ask

How do I revoke permissions in MySQL?

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.

Is revoke available in MySQL?

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.

Does MySQL allow you to choose cascading or non cascading revoke?

MySQL doesn't implement the RESTRICT / CASCADE options in the REVOKE statement.

What keyword revokes permissions for a particular user?

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.


1 Answers

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

like image 133
t1f Avatar answered Oct 11 '22 17:10

t1f