Database Reference
In-Depth Information
Figure 12.7
DESCRIBE tables_priv.
Figure 12.8
Mary's entry in the tables_priv table.
Figure 12.9 shows what happens if we view the
tables_priv
table after running the
GRANT query above. If you compare it with Figure 12.8 you will see that instead of adding
another row for the INSERT privilege it has appended the first entry. The
tables_priv
col-
umn now reads Select and Insert.
The Grant Tables
The
user
and
tables_priv
tables are known as the grant tables. These tables control every-
one's access to your MySQL server. There are five grant tables in all, as shown in Table 12.1.
All of these tables are stored within the
mysql
database, so you can refer to them directly
when using GRANT or REVOKE by adding
mysql.
to the front of the table name, i.e.
mysql.db
,
mysql.tables_priv
,
mysql.columns_priv
,etc.
Generally, you do not need to know what is going on within all of these tables, as long as
you understand how the GRANT and REVOKE queries work. However, it is useful to real-
ize that MySQL uses its own tables to store the privileges in, and you can access these using
the normal query mechanisms.
Search WWH ::
Custom Search