Privileges Provided by MySQL
575
If your privileges are changed (either by yourself or someone else) while you are connected, those
changes do not necessarily take effect immediately for the next statement that you issue. For details
about the conditions under which the server reloads the grant tables, see
Section 6.2.6, “When
Privilege Changes Take Effect”
.
For general security-related advice, see
Section 6.1, “General Security Issues”
. For help in diagnosing
privilege-related problems, see
Section 6.2.7, “Causes of Access-Denied Errors”
.
6.2.1. Privileges Provided by MySQL
MySQL provides privileges that apply in different contexts and at different levels of operation:
• Administrative privileges enable users to manage operation of the MySQL server. These privileges
are global because they are not specific to a particular database.
• Database privileges apply to a database and to all objects within it. These privileges can be granted
for specific databases, or globally so that they apply to all databases.
• Privileges for database objects such as tables, indexes, views, and stored routines can be granted
for specific objects within a database, for all objects of a given type within a database (for example,
all tables in a database), or globally for all objects of a given type in all databases).
Information about account privileges is stored in the
user
,
db
,
host
,
tables_priv
,
columns_priv
,
and
procs_priv
tables in the
mysql
database (see
Section 6.2.2, “Privilege System Grant Tables”
).
The MySQL server reads the contents of these tables into memory when it starts and reloads them
under the circumstances indicated in
Section 6.2.6, “When Privilege Changes Take Effect”
. Access-
control decisions are based on the in-memory copies of the grant tables.
Some releases of MySQL introduce changes to the structure of the grant tables to add new access
privileges or features. Whenever you update to a new version of MySQL, you should update your grant
tables to make sure that they have the current structure so that you can take advantage of any new
capabilities. See
Section 4.4.9, “
mysql_upgrade
— Check Tables for MySQL Upgrade”
.
The following table shows the privilege names used at the SQL level in the
GRANT
and
REVOKE
statements, along with the column name associated with each privilege in the grant tables and the
context in which the privilege applies.
Table 6.2. Permissible Privileges for
GRANT
and
REVOKE
Privilege
Column
Context
CREATE
[576]
Create_priv
databases, tables, or indexes
DROP
[577]
Drop_priv
databases, tables, or views
GRANT OPTION
[577]
Grant_priv
databases, tables, or stored routines
LOCK TABLES
[577]
Lock_tables_priv
databases
REFERENCES
[577]
References_priv
databases or tables
ALTER
[576]
Alter_priv
tables
DELETE
[577]
Delete_priv
tables
INDEX
[577]
Index_priv
tables
INSERT
[577]
Insert_priv
tables or columns
SELECT
[578]
Select_priv
tables or columns
UPDATE
[578]
Update_priv
tables or columns
CREATE TEMPORARY
TABLES
[576]
Create_tmp_table_priv
tables
CREATE VIEW
[577]
Create_view_priv
views
Summary of Contents for 5.0
Page 1: ...MySQL 5 0 Reference Manual ...
Page 18: ...xviii ...
Page 60: ...40 ...
Page 396: ...376 ...
Page 578: ...558 ...
Page 636: ...616 ...
Page 844: ...824 ...
Page 1234: ...1214 ...
Page 1427: ...MySQL Proxy Scripting 1407 ...
Page 1734: ...1714 ...
Page 1752: ...1732 ...
Page 1783: ...Configuring Connector ODBC 1763 ...
Page 1793: ...Connector ODBC Examples 1773 ...
Page 1839: ...Connector Net Installation 1819 2 You must choose the type of installation to perform ...
Page 2850: ...2830 ...
Page 2854: ...2834 ...
Page 2928: ...2908 ...
Page 3000: ...2980 ...
Page 3122: ...3102 ...
Page 3126: ...3106 ...
Page 3174: ...3154 ...
Page 3232: ...3212 ...