Account Management Statements
1154
Global Privileges
Global privileges are administrative or apply to all databases on a given server. To assign global
privileges, use
ON *.*
syntax:
GRANT ALL ON *.* TO 'someuser'@'somehost';
GRANT SELECT, INSERT ON *.* TO 'someuser'@'somehost';
Before MySQL 5.0.23, privileges also are assigned at the global level if you use
ON *
syntax and you
have not selected a default database. As of 5.0.23,
ON *
requires a default database and produces an
error if there is none.
The
CREATE USER
[576]
,
FILE
[577]
,
PROCESS
[577]
,
RELOAD
[577]
,
REPLICATION CLIENT
[577]
,
REPLICATION SLAVE
[577]
,
SHOW DATABASES
[578]
,
SHUTDOWN
[578]
, and
SUPER
[578]
privileges
are administrative and can only be granted globally.
Other privileges can be granted globally or at more specific levels.
MySQL stores global privileges in the
mysql.user
table.
Database Privileges
Database privileges apply to all objects in a given database. To assign database-level privileges, use
ON db_name.*
syntax:
GRANT ALL ON mydb.* TO 'someuser'@'somehost';
GRANT SELECT, INSERT ON mydb.* TO 'someuser'@'somehost';
If you use
ON *
syntax (rather than
ON *.*
) and you have selected a default database, privileges are
assigned at the database level for the default database. An error occurs if there is no default database.
The
CREATE
,
DROP
,
GRANT OPTION
[577]
, and
LOCK TABLES
[577]
privileges can be specified at the
database level. Table or routine privileges also can be specified at the database level, in which case
they apply to all tables or routines in the database.
MySQL stores database privileges in the
mysql.db
table.
Table Privileges
Table privileges apply to all columns in a given table. To assign table-level privileges, use
ON
db_name.tbl_name
syntax:
GRANT ALL ON mydb.mytbl TO 'someuser'@'somehost';
GRANT SELECT, INSERT ON mydb.mytbl TO 'someuser'@'somehost';
If you specify
tbl_name
rather than
db_name.tbl_name
, the statement applies to
tbl_name
in the
default database. An error occurs if there is no default database.
The permissible
priv_type
values at the table level are
ALTER
[576]
,
CREATE VIEW
[577]
,
CREATE
[576]
,
DELETE
[577]
,
DROP
[577]
,
GRANT OPTION
[577]
,
INDEX
[577]
,
INSERT
[577]
,
SELECT
[578]
,
SHOW VIEW
[578]
, and
UPDATE
[578]
.
MySQL stores table privileges in the
mysql.tables_priv
table.
Column Privileges
Column privileges apply to single columns in a given table. Each privilege to be granted at the column
level must be followed by the column or columns, enclosed within parentheses.
GRANT SELECT (col1), INSERT (col1,col2) ON mydb.mytbl TO 'someuser'@'somehost';
The permissible
priv_type
values for a column (that is, when you use a
column_list
clause) are
INSERT
[577]
,
SELECT
[578]
, and
UPDATE
[578]
.
Содержание 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 ...