Account Management Statements
1156
GRANT ALL ON test.* TO ''@'localhost' ...
In this case, any user who connects from the local host with the correct password for the anonymous
user will be permitted access, with the privileges associated with the anonymous-user account.
For additional information about user name and host name values in account names, see
Section 6.2.3, “Specifying Account Names”
.
To specify quoted values, quote database, table, column, and routine names as identifiers. Quote user
names and host names as identifiers or as strings. Quote passwords as strings. For string-quoting
and identifier-quoting guidelines, see
Section 9.1.1, “String Literals”
, and
Section 9.2, “Schema Object
Names”
.
The “
_
” and “
%
” wildcards are permitted when specifying database names in
GRANT
statements that
grant privileges at the global or database levels. This means, for example, that if you want to use a “
_
”
character as part of a database name, you should specify it as “
\_
” in the
GRANT
statement, to prevent
the user from being able to access additional databases matching the wildcard pattern; for example,
GRANT ... ON `foo\_bar`.* TO ...
.
Warning
If you permit anonymous users to connect to the MySQL server, you should
also grant privileges to all local users as
user_name@localhost
. Otherwise,
the anonymous user account for
localhost
in the
mysql.user
table (created
during MySQL installation) is used when named users try to log in to the MySQL
server from the local machine. For details, see
Section 6.2.4, “Access Control,
Stage 1: Connection Verification”
.
To determine whether the preceding warning applies to you, execute the following query, which lists
any anonymous users:
SELECT Host, User FROM mysql.user WHERE User='';
To avoid the problem just described, delete the local anonymous user account using this statement:
DROP USER ''@'localhost';
GRANT
supports host names up to 60 characters long. Database, table, column, and routine names can
be up to 64 characters. User names can be up to 16 characters.
Warning
The permissible length for user names cannot be changed by altering the
mysql.user
table. Attempting to do so results in unpredictable behavior
which may even make it impossible for users to log in to the MySQL server.
You should never alter any of the tables in the
mysql
database in any manner
whatsoever except by means of the procedure described in
Section 4.4.9,
“
mysql_upgrade
— Check Tables for MySQL Upgrade”
.
The user specification may indicate how the user should authenticate when connecting to the server,
through inclusion of an
IDENTIFIED BY
clause. The syntax is the same as for the
CREATE USER
statement. See
Section 13.7.1.1, “
CREATE USER
Syntax”
.
When the
IDENTIFIED BY
clause is present and you have global grant privileges, the password
becomes the new password for the account, even if the account exists and already has a password.
With no
IDENTIFIED BY
clause, the account password remains unchanged.
If the
NO_AUTO_CREATE_USER
[536]
SQL mode is not enabled and the account named in a
GRANT
statement does not exist in the
mysql.user
table,
GRANT
creates it. If you specify no
IDENTIFIED
BY
clause or provide an empty password, the user has no password. This is very insecure.
Содержание 5.0
Страница 1: ...MySQL 5 0 Reference Manual ...
Страница 18: ...xviii ...
Страница 60: ...40 ...
Страница 396: ...376 ...
Страница 578: ...558 ...
Страница 636: ...616 ...
Страница 844: ...824 ...
Страница 1234: ...1214 ...
Страница 1426: ...MySQL Proxy Scripting 1406 The following diagram shows an overview of the classes exposed by MySQL Proxy ...
Страница 1427: ...MySQL Proxy Scripting 1407 ...
Страница 1734: ...1714 ...
Страница 1752: ...1732 ...
Страница 1783: ...Configuring Connector ODBC 1763 ...
Страница 1793: ...Connector ODBC Examples 1773 ...
Страница 1839: ...Connector Net Installation 1819 2 You must choose the type of installation to perform ...
Страница 1842: ...Connector Net Installation 1822 5 Once the installation has been completed click Finish to exit the installer ...
Страница 1864: ...Connector Net Visual Studio Integration 1844 Figure 20 24 Debug Stepping Figure 20 25 Function Stepping 1 of 2 ...
Страница 2850: ...2830 ...
Страница 2854: ...2834 ...
Страница 2928: ...2908 ...
Страница 3000: ...2980 ...
Страница 3122: ...3102 ...
Страница 3126: ...3106 ...
Страница 3174: ...3154 ...
Страница 3232: ...3212 ...