Specifications
field is blank, then no password is required. It’s more secure to avoid having blank users,
wildcards in hosts, and users without passwords.
2. Request verification. Each time you enter a request, after you have established a connec-
tion, MySQL checks whether you have the appropriate level of privileges to perform that
request. The system begins by checking your global privileges (in the user table) and if
they are not sufficient, checks the db and host tables. If you still don’t have sufficient
privileges, MySQL will check the tables_priv table, and, if this is not enough, finally it
will check the columns_priv table.
Updating Privileges: When Do Changes Take Effect?
The MySQL server automatically reads the grant tables when it is started, and when you issue
GRANT and REVOKE statements.
However, now that we know where and how those privileges are stored, we can alter them
manually. When you update them manually, the MySQL server will not notice that they have
changed.
You need to point out to the server that a change has occurred, and there are three ways you
can do this. You can type
FLUSH PRIVILEGES;
at the MySQL prompt (you will need to be logged in as an administrator to do this). This is the
most commonly used way of updating the privileges.
Alternatively you can run either
mysqladmin flush-privileges
or
mysqladmin reload
from your operating system.
After this, global level privileges will be checked the next time a user connects; database privi-
leges will be checked when the next use statement is issued; and table and column level privi-
leges will be checked on a user’s next request.
Making Your MySQL Database Secure
Security is important, especially when you begin connecting your MySQL database to your
Web site. In this section, we’ll look at the precautions you ought to take to protect your data-
base.
Advanced MySQL
C
HAPTER 11
11
ADVANCED
MY
SQL
251
14 7842 CH11 3/6/01 3:35 PM Page 251