Databases Reference
In-Depth Information
Instead of defining cumbersome column-specific privileges on many tables, it's easier
to prepare a view containing a limited set of columns from these tables. We can then
grant permissions on the view as a whole.
To activate support for views on a server after an upgrade from a pre-5.0 version,
the administrator has to execute the
mysql_upgrade
program, as described in the
MySQL manual (
http://dev.mysql.com/doc/refman/5.0/en/upgrading-from-
previous-series.html
).
Each user must have the appropriate
SHOW_VIEW
or
CREATE_VIEW
privilege to be able to see or manipulate views. These privileges
exist at the global (server), database, and table levels.
Creating a view implies that the user has privileges on the tables involved, or at least
a privilege such as
SELECT
or
UPDATE
on all the columns mentioned in the view.
Creating a view from results
We can take advantage of phpMyAdmin's
Search
(at the table level) or
Query
(at the
database level) features to build a rather complex query, execute it, and then easily
create a view from the results. We will see how this is done.
We mentioned that a view can be used to limit the visibility of columns (and, in
fact, of tables). Let us say that the number of pages in a book is highly classified
information. We open the
book
table, click on
Search
, and choose a subset of the
columns that does not include the
page_count
column (we might have to open the
Options
slider).
Search WWH ::
Custom Search