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.

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

If you do this, you can then view the tables in this database as usual by typing<br />

show tables;<br />

Your results look something like this:<br />

+---------------------------+<br />

| Tables_in_mysql |<br />

+---------------------------+<br />

| columns_priv |<br />

| db |<br />

| event |<br />

| func |<br />

| general_log |<br />

| help_category |<br />

| help_keyword |<br />

| help_relation |<br />

| help_topic |<br />

| host |<br />

| ndb_binlog_index |<br />

| plugin |<br />

| proc |<br />

| procs_priv |<br />

| servers |<br />

| slow_log |<br />

| tables_priv |<br />

| time_zone |<br />

| time_zone_leap_second |<br />

| time_zone_name |<br />

| time_zone_transition |<br />

| time_zone_transition_type |<br />

| user |<br />

+---------------------------+<br />

Each of these tables stores system information. Six of them—user, host, db,<br />

tables_priv, columns_priv, <strong>and</strong> procs priv—store privilege information.They are<br />

sometimes called grant tables.These tables vary in their specific function but all serve the<br />

same general function, which is to determine what users are <strong>and</strong> are not allowed to do.<br />

Each of them contains two types of fields: scope fields, which identify the user, host, <strong>and</strong><br />

part of a database that the privilege refers to; <strong>and</strong> privilege fields, which identify which<br />

actions can be performed by that user in that scope.<br />

The user <strong>and</strong> host tables are used to decide whether a user can connect to the<br />

<strong>MySQL</strong> server at all <strong>and</strong> whether she has any administrator privileges.The db <strong>and</strong> host<br />

tables determine which databases the user can access.The tables_priv table determines<br />

which tables within a database a user can use, the columns_priv table determines which<br />

columns within tables she has access to, <strong>and</strong> the procs priv table determines which<br />

routines a user can execute.

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

Saved successfully!

Ooh no, something went wrong!