Q&A

Q1:Are GRANT and REVOKE the only ways of managing user privileges?
A1: No, there are other ways, and prior to MySQL 3.22.11, these commands weren't even implemented.

You can modify user privileges by editing the grant tables directly. For example, you would create a new user in the user table like this:

INSERT INTO user SET Host="localhost",
  User="someuser",
  Password=PASSWORD("somepass"),
  Select_priv="Y"
  Insert_priv="Y"

For database-specific privileges (which you ought normally to be doing), you would also insert an entry into db, and there may well be entries into host, tables_priv, and even columns_priv.

Although there's no technical difference in the outcome, these commands can be lengthy and prone to minor errors. GRANT and REVOKE

Get Sams Teach Yourself MySQL in 21 Days, Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.