MySQL Workbench: Users and Privileges
The Users and Privileges tab of MySQL Workbench allows you to administer users and their respective privileges for the MySQL instance.
To display the Users and Privileges tab, click Users and Privileges on the Management tab:
You should see a screen similar to this:
The Users and Privileges screen displays a list of all users, along with relevant details for each account. Here, an administrator can create new user accounts, set their password, authentication type, their administrative roles, and schema privileges, if any.
Clicking on the various buttons will display their respective tabs.
The Account Limits Tab
This tab allows you to set limits on:
- The number of queries that an account can issue per hour
- The number of updates that an account can issue per hour
- The number of times an account can connect to the server per hour
- The number of simultaneous connections to the server by an account
According to the MySQL documentation:
Any statement that a client can issue counts against the query limit, unless its results are served from the query cache. Only statements that modify databases or tables count against the update limit.
The Administrative Roles Tab
The Administrative Roles tab allows you to apply a role (or roles) for each user. DBA is the highest role — a DBA can perform all tasks. Other roles are more specific to a particular task (or set of tasks) that a user might be allowed to perform. You can also set the Global Privileges in this screen. In the above screenshot, the user has full access to all options. When you create a new user, you might only allow a small number of options for that user. For example, you might restrict one user to only being able to perform SELECT
, INSERT
, and UPDATE
statements, while another might be able to perform DELETE
and even DROP
statements in addition to those.
It's good practice to limit user privileges and roles to the bare minimum that the user needs. Never grant a user account more access than it needs. Privileges can always be added later if required.
The Schema Privileges Tab
The Schema Privileges tab is used for adding schema privileges to a user account. This enables that user to perform the given actions based on the rights given to them in this screen.