2

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.

dasHannon
  • 305
  • 1
  • 3
  • 12

3 Answers3

1

Try this, it helped me may be you too

REVOKE ALL on dbName.* from 'user'@'host';
FLUSH PRIVILEGES;
Prakash Bhagat
  • 1,406
  • 16
  • 30
0

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

jmail
  • 5,944
  • 3
  • 21
  • 35
  • But it would revoke Privileges to all the databases, wound't it? I was thinking about not granting from now on but keeping the old ones – dasHannon Apr 09 '14 at 11:42
  • refer this link: http://stackoverflow.com/questions/17799806/remove-privileges-from-mysql-database – jmail Apr 09 '14 at 11:45
  • thanks but not enough. They show how to erase privileges.. I just want to stop applying to new databases without erasing them for each new db. – dasHannon Apr 09 '14 at 12:03
0

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

anggasantoso
  • 23
  • 1
  • 1
  • 5
  • The problem is that ON [database name] doesn't answear the question. I just want that those privileges don't apply to NEW databases. As you show, I would have to run that command to every new database. – dasHannon Apr 09 '14 at 12:01