Specifications
Each row in this table corresponds to a set of privileges for a user coming from a host and log-
ging in with the password Password. These are the scope fields for this table, as they describe
the scope of the other fields, called privilege fields.
The privileges listed in this table (and the others to follow) correspond to the privileges we
granted using GRANT in Chapter 8. For example, Select_priv corresponds to the privilege to run
a SELECT command.
If a user has a particular privilege, the value in that column will be Y. Conversely, if a user has
not been granted that privilege, the value will be N.
All the privileges listed in the user table are global, that is, they apply to all the databases in
the system (including the mysql database). Administrators will therefore have some Ys in there,
but the majority of users should have all
Ns. Normal users should have rights to appropriate
databases, not all tables.
The db and host Tables
Most of your average users’ privileges are stored in the tables db and host.
The db table determines which users can access which databases from which hosts. The privi-
leges listed in this table apply to whichever database is named in a particular row.
The host table supplements the db table. If a user is to connect to a database from multiple
hosts, no host will be listed for that user in the db table. Instead, she will have a set of entries
in the host table, one to specify the privileges for each user-host combination.
The schemas of these two tables are shown in Tables 11.2 and 11.3, respectively.
TABLE 11.2 Schema of the db Table in the mysql Database
Field Type
Host char(60)
Db char(64)
User char(16)
Select_priv enum(‘N’,’Y’)
Insert_priv enum(‘N’,’Y’)
Update_priv enum(‘N’,’Y’)
Delete_priv enum(‘N’,’Y’)
Create_priv enum(‘N’,’Y’)
Drop_priv enum(‘N’,’Y’)
Using MySQL
P
ART II
248
14 7842 CH11 3/6/01 3:35 PM Page 248