GRANT access in MySQL
After creating a user account, one still needs to tell MySQL what kind of privileges to assign to it. MySQL supports a wide range of privileges (see the table of privileges on page 9). A user can only grant any privilege that they have themselves.
As with creating a user, granting access can be done by modifying the mysql
tables directly. However, this method is error-prone and dangerous to the stability of the system and is, therefore, not recommended.
Important dynamics of GRANTing access
Where CREATE USER
causes MySQL to add a user account, it does not specify that user's privileges. In order to grant a user privileges, the account of the user granting the privileges must meet two conditions:
Be able to exercise those privileges in their account
Have the
GRANT OPTION
privilege on their account
Therefore, it is not just users who have a particular privilege or only users with the GRANT OPTION
privilege who can authorize a particular privilege for a user, but only users...