Specifications

Using MySQL
P
ART II
246
In this chapter, well cover some more advanced MySQL topics including advanced privileges,
security, and optimization.
The topics well cover are
Understanding the privilege system in detail
Making your MySQL database secure
Getting more information about databases
Speeding things up with indexes
Optimization tips
Different table types
Understanding the Privilege System in Detail
Previously (in Chapter 8, Creating Your Web Database) we looked at setting up users and
granting them privileges. We did this with the GRANT command. If youre going to administer a
MySQL database, it can be useful to understand exactly what GRANT does and how it works.
When you issue a GRANT statement, it affects tables in the special database called mysql.
Privilege information is stored in five tables in this database. Given this, when granting privi-
leges on databases, you should be cautious about granting access to the mysql database.
One side note is that the GRANT command is only available from MySQL version 3.22.11
onward.
We can look at whats in the mysql database by logging in as an administrator and typing
use mysql;
If you do this, you can then view the tables in this database by typing
show tables;
as usual.
The results you get will look something like this:
+-----------------+
| Tables in mysql |
+-----------------+
| columns_priv |
| db |
| host |
| tables_priv |
| user |
+-----------------+
14 7842 CH11 3/6/01 3:35 PM Page 246