Specifications

Each of these tables stores information about privileges. They are sometimes called grant
tables. These tables vary in their specific function but all serve the same general function,
which is to determine what users are and are not allowed to do. Each of them contains two
types of fields: scope fields, which identify the user, host, and part of a database; and privilege
fields, which identify which actions can be performed by that user in that scope.
The user table is used to decide whether a user can connect to the MySQL server and whether
she has any administrator privileges. The db and host tables determine which databases the
user can access. The tables_priv table determines which tables within a database a user can
use, and the columns_priv table determines which columns within tables they have access to.
The user Table
This table contains details of global user privileges. It determines whether a user is allowed to
connect to the MySQL server at all, and whether she has any global level privileges; that is,
privileges that apply to every database in the system.
We can see the structure of this table by issuing a
describe user; statement.
The schema for the user table is shown in Table 11.1.
TABLE 11.1 Schema of the user Table in the mysql Database
Field Type
Host char(60)
User char(16)
Password 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’)
Reload_priv enum(‘N’,’Y’)
Shutdown_priv enum(‘N’,’Y’)
Process_priv enum(‘N’,’Y’)
File_priv enum(‘N’,’Y’)
Grant_priv enum(‘N’,’Y’)
References_priv enum(‘N’,’Y’)
Index_priv enum(‘N’,’Y’)
Alter_priv enum(’N’,’Y’)
Advanced MySQL
C
HAPTER 11
11
ADVANCED
MY
SQL
247
14 7842 CH11 3/6/01 3:35 PM Page 247