Ravi Sir's Cyber Security Cards › Revision Cards
Users, GRANT, REVOKE and Least Privilege
Users, GRANT, REVOKE and Least Privilege GRANT gives a database user permissions. REVOKE takes them away. Least privilege = give only what is needed. If the web app uses root , one SQL injection controls the whole database. With a limited user, the attacker cannot drop databases or write files. GRAN

Read card text
What this card says
What it is
GRANT gives a database user permissions. REVOKE takes them away.
Least privilege = give only what is needed.
Why it matters for security
If the web app uses root, one SQL injection controls the whole database.
With a limited user, the attacker cannot drop databases or write files.
Common mistake
GRANT ALL PRIVILEGES ON *.* TO 'app'@'%' gives everything, from anywhere.
Better: GRANT SELECT, INSERT, UPDATE ON shop.* TO 'app'@'localhost';
| Host part | Who can connect |
|---|---|
| 'localhost' | Only from the same server |
| '10.0.1.%' | Any machine in 10.0.1.0/24 |
| '%' | From anywhere – avoid |
Learn more in the lesson: 11.7 Users, GRANT, REVOKE and Least Privilege