dasHannon
dasHannon

Reputation: 305

Stop mySQL GRANT ALL, not just erasing

Imagine that I run this command:

GRANT ALL PRIVILEGES ON *.* TO 'user'@'host';

Now in every new DB, the user has full access. The question is, imagine that at some point I want that those . privileges don't apply to new databases. Is that possible?

I just thought about erasing user and GRANT privileges to the last db's created but it could be quite hard if there are a lot of them... and I wondered if there was a "REVOKE from now on ..." hidden from google command.

Upvotes: 2

Views: 213

Answers (3)

Prakash Bhagat
Prakash Bhagat

Reputation: 1446

Try this, it helped me may be you too

REVOKE ALL on dbName.* from 'user'@'host';
FLUSH PRIVILEGES;

Upvotes: 1

anggasantoso
anggasantoso

Reputation: 23

maybe you should try this

REVOKE [type of permission] ON [database name].[table name] FROM ‘[username]’@‘localhost’;
  • ALL PRIVILEGES- this would allow a MySQL user all access to a designated database (or if no database is selected, across the system)
  • CREATE- allows them to create new tables or databases

  • DROP- allows them to them to delete tables or databases

  • DELETE- allows them to delete rows from tables

  • INSERT- allows them to insert rows into tables

  • SELECT- allows them to use the Select command to read through databases

  • UPDATE- allow them to update table rows

https://www.digitalocean.com/community/articles/how-to-create-a-new-user-and-grant-permissions-in-mysql

Upvotes: 0

jmail
jmail

Reputation: 6132

try this:

REVOKE ALL PRIVILEGES ON *.* FROM user [, user] ...
REVOKE GRANT OPTION ON *.* FROM user [, user] ...

https://dev.mysql.com/doc/refman/4.1/en/revoke.html

Upvotes: 0

Related Questions