13.09.2016 Views

PHP and MySQL Web Development 4th Ed-tqw-_darksiderg

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

290 Chapter 12 Advanced <strong>MySQL</strong> Administration<br />

Table 12.1<br />

Field<br />

Continued<br />

Type<br />

Trigger_priv<br />

enum('N','Y')<br />

ssl_type<br />

enum('','ANY','X509','SPECIFIED')<br />

ssl_cipher<br />

blob<br />

x509_issuer<br />

blob<br />

x509_subject blob max_questions int(11) unsigned<br />

max_updates<br />

int(11) unsigned<br />

max_connections<br />

int(11) unsigned<br />

max_user_connections int(11) unsigned<br />

Each row in this table corresponds to a set of privileges for a User coming from a Host<br />

<strong>and</strong> logging in with the password Password.These are the scope fields for this table<br />

because they describe the scope of the other fields, called privilege fields.<br />

The privileges listed in this table (<strong>and</strong> the others to follow) correspond to the privileges<br />

granted using GRANT in Chapter 9. For example, Select_priv corresponds to the<br />

privilege to run a SELECT comm<strong>and</strong>.<br />

If a user has a particular privilege, the value in that column will be Y. Conversely, if a<br />

user has not been granted that privilege, the value will be N.<br />

All the privileges listed in the user table are global; that is, they apply to all the<br />

databases in the system (including the mysql database). Administrators will therefore have<br />

some Ys in there, but the majority of users should have all Ns. Normal users should have<br />

rights to appropriate databases, not all tables.<br />

The db <strong>and</strong> host Tables<br />

Most of your average users’ privileges are stored in the tables db <strong>and</strong> host.<br />

The db table determines which users can access which databases from which hosts.<br />

The privileges listed in this table apply to whichever database is named in a particular<br />

row.<br />

The host table supplements the user <strong>and</strong> db tables. If a user is to connect from multiple<br />

hosts, no host will be listed for that user in the user or db table. Instead, he will<br />

have a set of entries in the host table, one to specify the privileges for each user-host<br />

combination.<br />

The schemas of these two tables are shown in Tables 12.2 <strong>and</strong> 12.3, respectively.<br />

Table 12.2<br />

Field<br />

Schema of the db Table in the mysql Database<br />

Type<br />

Host<br />

Db<br />

User<br />

Select_priv<br />

char(60)<br />

char(64)<br />

char(16)<br />

enum(‘N’,’Y’)

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!