mySQL comes with a pretty powerful security system, the grant tables, which allows database administrators to precisely control access to databases, tables and even specific rows and columns. In this article, find out how the five grant tables combine to offer power users a tremedous amounts of flexibility and control over database access and operations.
In addition to the three tables already discussed, newer versions of mySQL also come with two additional tables, the "tables_priv" and "columns_priv" tables. These allow a database administrator to restrict access to specific tables in a database, and specific columns of a specific table, respectively.
The following example would restrict user to performing
SELECT operations on table "cream" *only* - any attempt to run a SELECT query on another table within the same database would result in an error.
+-----------------+-------+------+------------+---------------+-------------+
| Host | Db | User | Table_name | Table_priv | Column_priv |
+-----------------+-------+------+------------+---------------+-------------+
|lost.soul.com | db563 | john | cream | Select | |
+-----------------+-------+------+------------+---------------+-------------+