11.07.2015 Views

PHP MySQL - Stilson.net

PHP MySQL - Stilson.net

PHP MySQL - Stilson.net

SHOW MORE
SHOW LESS
  • No tags were found...

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

CHAPTER 29 • SECURING MYSQLwww.it-ebooks.infowant to take advantage of the added security offered by the longer hashes, you need to increase the sizeof the Password column to fit the new space requirement. You can do so either by manually altering thetable with the ALTER command or by running the utility mysql_fix_privilege_tables. (This file has beenreplaced with the mysql_upgrade script as of <strong>MySQL</strong> version 5.1.7.) If you choose not to alter the table, orcannot, then <strong>MySQL</strong> will still allow you to maintain passwords, but will continue to use the old methodfor doing so.USER IDENTIFICATION<strong>MySQL</strong> identifies a user not just by the supplied username, but by the combination of the suppliedusername and the originating hostname. For example, jason@localhost is entirely different fromjason@www.wjgilmore.com. Furthermore, keep in mind that <strong>MySQL</strong> will always apply the most specificset of permissions that matches the supplied user@host combination. Although this may seem obvious,sometimes unforeseen consequences can happen. For example, it’s often the case that multiple rowsmatch the requesting user/host identity; even if a wildcard entry that satisfies the supplied user@hostcombination is seen before a later entry that perfectly matches the identity, the privileges corresponding tothat perfect match will be used instead of the wildcard match. Therefore, always take care to ensure thatthe expected privileges are indeed supplied for each user. Later in this chapter, you’ll see how to viewprivileges on a per-user basis.The Privilege ColumnsThe next 28 columns listed in Table 29-1 comprise the user privilege columns. Keep in mind that theseare representative of the user’s global privileges when discussed in the context of the user table.• Select_priv: Determines whether the user can select data via the SELECTcommand.• Insert_priv: Determines whether the user can insert data via the INSERTcommand.• Update_priv: Determines whether the user can modify existing data via the UPDATEcommand.• Delete_priv: Determines whether the user can delete existing data via the DELETEcommand.• Create_priv: Determines whether the user can create new databases and tables.• Drop_priv: Determines whether the user can delete existing databases and tables.• Reload_priv: Determines whether the user can execute various commandsspecific to flushing and reloading of various internal caches used by <strong>MySQL</strong>,including logs, privileges, hosts, queries, and tables.• Shutdown_priv: Determines whether the user can shut down the <strong>MySQL</strong> server.You should be very wary of providing this privilege to anybody except the rootaccount.566

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

Saved successfully!

Ooh no, something went wrong!