Web server setup - Chapter 12 . Security 327 Note You can
Chapter 12 . Security 327 Note You can create user accounts in MySQL by one of two methods: Using the GRANT statement or using the INSERTstatement. For the purposes of this chapter I will be concentrating solely on the GRANT statement and its opposite statement, REVOKE. If you choose to use an INSERT or UPDATE statement for working with the grants database, you must use the FLUSH PRIVILEGESstatement as well. If you use a GRANT or REVOKE statement, the database server sees the changes immediately. If you change a user s access to a database while they are connected to that database, the change will not take effect immediately for that user. In addition, if you change a user s global privileges or change their password it will not take effect until the next time they connect. Therefore, you should kill the user s process in order for the changes to take effect for these instances. Two macro-level grants are not listed in Table 12-1: the ALL PRIVILEGES and USAGE macros. The ALL PRIVILEGESmacro can be substituted in a GRANTor REVOKE statement instead of having to enumerate each of the privileges. The USAGE macro simply creates the user account with no privileges. In other words, think of the USAGE macro as a placeholder. It allows the administrator to create the user account and come back to it later to set privileges. The ALL PRIVILEGES macro does not include (and so does not grant) the administrative privilege of granting and revoking privileges. Adding users and granting privileges In MySQL, adding a user and granting privileges can occur simultaneously. You can also add multiple users with the same privileges simultaneously. The basic statement for adding a user and setting privileges is the GRANTstatement. The syntax for the GRANT statement is as follows: GRANT privilege [(
From our experience, we can recommend PHP Web Hosting services, if you need affordable webhost to host and run your web application.