Specifications
TABLE 11.4 Schema of the tables_priv Table in the mysql Database
Field Type
Host char(60)
Db char(64)
User char(16)
Table_name char(64)
Grantor char(77)
Timestamp timestamp(14)
Table_priv set(‘Select’, ‘Insert’, ‘Update’, ‘Delete’, ‘Create’, ‘Drop’,
‘Grant’, ‘References’, ‘Index’, ‘Alter’)
Column_priv set(‘Select’, ‘Insert’, ‘Update’, ‘References’)
TABLE 11.5 Schema of the columns_priv Table in the mysql Database
Field Type
Host char(60)
Db char(60)
User char(16)
Table_name char(60)
Column_name char(59)
Timestamp timestamp(14)
Column_priv set(‘Select’, ’Insert’, ‘Update’, ‘References’)
The Grantor column in the tables_priv table stores the user who granted this privilege to this
user. The Timestamp column in both these tables stores the date and time when the privilege
was granted.
Access Control: How MySQL Uses the Grant Tables
MySQL uses the grant tables to determine what a user is allowed to do in a two-stage process:
1. Connection verification. Here, MySQL checks whether you are allowed to connect at all,
based on information from the user table, as shown previously. This is based on your
username, hostname, and password. If a username is blank, it matches all users.
Hostnames can be specified with a wildcard character (%). This can be used as the entire
field—that is, % matches all hosts—or as part of a hostname, for example,
%.tangledweb.com.au matches all hosts ending in .tangledweb.com.au. If the password
Using MySQL
P
ART II
250
14 7842 CH11 3/6/01 3:35 PM Page 250