330 Part III . Administration If you are (Web hosting plans)

330 Part III . Administration If you are unsure of the grants that a given user has, you can issue the SHOW GRANTS FOR statement. For example, to find out the grants and privileges given to Webuser (from a previous example in this chapter), issue the following statement: SHOW GRANTS FOR Webuser@localhost; Deleting users and revoking privileges The REVOKE statement is used to remove privileges from a user. The syntax for the REVOKE statement is as follows: REVOKE privilege [()] [, privilege [()] …] ON [
| * | *.* | .*] FROM username [, username …] The syntax is quite similar to that of the GRANT statement. The REVOKE statement can apply to a column or columns, databases and tables can be specified and wild- carded and multiple users can be revoked simultaneously. The ALL PRIVILEGESmacro works with the REVOKE statement the same as with the GRANTstatement. This is important to know because if you have granted the GRANT privilege to the user and use a REVOKE ALL PRIVILEGES statement, the GRANT option will still be there! Therefore, you must perform a separate statement of REVOKE GRANT OPTION … for this occasion. Issuing a REVOKEstatement does not delete the user from the MySQL grants database. To delete a user from the grants database you must specifically issue a DELETE statement to remove them from the grants database. Caution Use caution when issuing any REVOKE or DELETE statements as you can easily revoke all privileges from all users or even delete all users from the database, including the root user! The syntax for the DELETE statement is the same to remove user accounts as it is to delete rows from the tables of other databases. Remember that MySQL uses the user and host combined to identify a user. Therefore you can have as many users with the username robertin the database, but only one robert that connects from a specific host. Therefore you must be extremely careful when issuing the DELETE statement so as to not delete all those other Bobs from the database server! A misguided or careless DELETE statement can result in removal of all privileges for all users, not just for robert. After issuing the correct DELETEstatement, don t forget to run the FLUSH PRIVILEGES statement so the deletion takes effect on the server. Figure 12-19 shows all privileges being revoked from an example user, after which a deletion removes the user account entirely from the database.
Check Tomcat Web Hosting services for best quality webspace to host your web application.

Leave a Reply