Free web hosts - 268 Part II . PHP and MySQL Table
Friday, February 29th, 2008268 Part II . PHP and MySQL Table 14-1 (continued) Privilege Global Database Table Column SHOW DATABASES . SHUTDOWN . SUPER . . UPDATE . . . . USAGE . . GRANT OPTION . . . Obviously, there s no point in trying to give anyone the SHUTDOWN privilege at the table level. You will merely get an error message telling you to RTFM. If you grant ALL to a column, table, or database, the user will get only the basket of privileges appropriate to that level. You should be extra-careful about giving users the following privileges, which are all dangerous: GRANT, ALTER, CREATE, DROP, FILE, SHUTDOWN, PROCESS. No normal database user, especially a PHP user, should need these permissions in production. The syntax for revoking privileges is very similar, although simpler: REVOKE priv_type [(column1, column2, column3)] ON database[.table] FROM user@host; After you grant or revoke privileges to any user, you need to force the database to reload the new privilege data into memory. You do this by issuing the FLUSH PRIVILEGES command. You could also start and stop the server, but that s impractical in many circumstances. This is all well and good, but by now you re probably thinking: But what actual permissions should I actually grant to my actual PHP user? Let s look at some common cases from the real world. Local development For purely local stuff, especially on a machine that isn t connected to the Internet all the time or is tucked securely behind a good firewall, almost anything goes. If you need to experiment with your schema, this is the place to do it so it s appropriate to have permissions like ALTER, CREATE, DELETE, and DROP in addition to the normal SELECT, INSERT, UPDATE. A lot of people will find it convenient to just grant ALL PRIVILEGES on a certain database to a local user, like this: GRANT ALL PRIVILEGES on database.* TO username@localhost IDENTIFIED BY password ; Standalone Web site A self-hosted database probably needs to accept connections from numerous Web servers in the same domain. In production, all machines should be limited to SELECT, INSERT, UPDATE, and possibly DELETE although many systems never actually delete data, and it s a little safer not to do so. Since there probably won t be multiple databases on a standalone Web
Searching for affordable and proven webhost to host and run your servlet applications? Go to Linux Web Hosting services and you will find it.