1

I was making a SQL file on MySQL as part of a school asignement and I think I got everyting right but a part where it specifies my to create an user an then revoke all permission from him

All sources I have found use something like

CREATE USER IF NOT EXISTS user; REVOKE ALL ON *.* FROM user;

or

CREATE USER IF NOT EXISTS user; REVOKE ALL ON *.* TO USER user;

But both return a systax error in the "FROM/TO" saying that a EOF is expected and I don't even know what is that; am I doing something wrong here?

Should I refer to something first, separate the code sentence or what am I missing?

Seems like a pretty easy task to do and the rest of the code is working, but that error is driving me crazy

1 Answers1

1

This syntax drops all global, database, table, column, and routine privileges for the named users or roles:

REVOKE ALL PRIVILEGES, GRANT OPTION
  FROM user;
Tom Price
  • 191
  • 1
  • 10
  • It seems to work, but what does "GRANT OPTION" means? Am I giving the user privileges before revoking them? – Daleo dorito Jan 20 '23 at 01:15
  • Grant option enables you to grant to or revoke from other users those privileges that you yourself possess. There is a very thorough explanation in the MySQL docs for the REVOKE statement including examples: http://dev.mysql.com/doc/refman/8.0/en/revoke.html – Tom Price Jan 20 '23 at 01:20
  • So the GRANT OPTION is just giving me permission to do the previous sentence of REVOKE ALL PRIVILEGES – Daleo dorito Jan 20 '23 at 01:25
  • I believe that is correct. This specific task in described in the MySQL docs. – Tom Price Jan 20 '23 at 01:34