
/* Chapter 14 - Examples */


CREATE TABLE Books
(
   BookID SMALLINT NOT NULL PRIMARY KEY,
   BookTitle VARCHAR(60) NOT NULL,
   Copyright YEAR NOT NULL
)
ENGINE=INNODB;


SELECT host, user, select_priv, update_priv FROM user WHERE user='user1';
SELECT host, db, user, table_name, table_priv, column_priv 
   FROM tables_priv WHERE user='user1';
SELECT host, db, user, table_name, column_name, column_priv 
   FROM columns_priv WHERE user='user1';


GRANT SELECT, UPDATE (BookTitle, Copyright)
ON test.Books
TO 'user1'@'domain1.com' IDENTIFIED BY 'pw1'
REQUIRE SSL;


GRANT SELECT, UPDATE (BookTitle, Copyright)
ON test.Books
TO 'user1'@'domain1.com' IDENTIFIED BY 'pw1'
REQUIRE SUBJECT 'test client cert.'
  AND ISSUER 'Test C.A.';


GRANT SELECT, UPDATE
ON test.*
TO 'user1'@'domain1.com' IDENTIFIED BY 'pw1'
WITH GRANT OPTION MAX_QUERIES_PER_HOUR 50 MAX_UPDATES_PER_HOUR 50;


GRANT SELECT, UPDATE
ON test.*
TO 'user1'@'domain1.com' IDENTIFIED BY 'pw1'
WITH GRANT OPTION MAX_QUERIES_PER_HOUR 50 MAX_UPDATES_PER_HOUR 50;


