To accommodate granting rights to users from arbitrary hosts, MySQL supports
specifying the user
value in the form
. If a user_name
@host_name
user_name
or host_name
value is legal as an unquoted
identifier, you need not quote it. However, quotes are necessary to specify a
user_name
string containing special
characters (such as “-
”), or
a host_name
string containing special
characters or wildcard characters (such as “%
”); for example, 'test-user'@'test-hostname'
. Quote the username and
hostname separately.
You can specify wildcards in the hostname. For example,
applies to user_name
@'%.loc.gov'user_name
for any host in the loc.gov
applies to
user_name
@'144.155.166.%'user_name
for any host in the 144.155.166
class C subnet. domain, and
The simple form user_name
is a
synonym for
.
user_name
@'%'
user_name与
user_name
@'%'效果相同。