0

What is the difference between *, %, Any in the username/host fields when granting permissions to a user, and how would the combination of them differ?

For example:

GRANT ALL PRIVILEGES ON db.* TO '*'@'Any';

would this be the same as

GRANT ALL PRIVILEGES ON db.* TO 'Any'@'%';

EDIT: The Any field I was thinking of comes from phpMyAdmin. Perhaps it means something different? I have pasted a screenshot below to illustrate what I mean.

User permissions in phpMyAdmin

xiankai
  • 2,773
  • 3
  • 25
  • 31

1 Answers1

1

The word "any" has no special meaning.

MySQL does not support wildcards in the user name, so the first example is illegal. To grant privileges to an anonymous user from a host called any use:

GRANT ALL PRIVILEGES ON db.* TO ''@'Any';

The second example is legal, but it grants privileges to a user called "any" who may connect from any host.

Joni
  • 108,737
  • 14
  • 143
  • 193
  • Thanks for the answer. The `Any` field comes from phpMyAdmin apparently, and I updated my answer to illustrate the specific examples I need to understand. – xiankai Oct 09 '13 at 02:51