QuestionQ162

Database Security

Examine the following commands and output:

Question Image

Jane must create a temporary table named TOTALSALES in the SALES database.

Which statement grants Jane the necessary privileges while following the principle of least privilege?

  • A GRANT CREATE TEMPORARY TABLES ON sales.totalsales TO jane;
  • B GRANT CREATE TEMPORARY TABLES ON sales.* TO jane;
  • C GRANT ALL ON sales.* TO jane;
  • D GRANT CREATE TEMPORARY TABLES, INSERT, UPDATE, DELETE, SELECT ON sales.totalsales TO jane;
Explanation

MySQL requires the CREATE TEMPORARY TABLES privilege to execute CREATE TEMPORARY TABLE. That privilege has database scope, so granting it on sales.* is sufficient for temporary tables in SALES; it cannot be granted at the individual-table scope. Once Jane creates the temporary table, her session can perform operations on it without separate INSERT, UPDATE, DELETE, or SELECT privileges, so additional privileges are not required.

Learn more

Community Discussion

No comments yet. Be the first to start the discussion!